xserver-multidpi/mi
Peter Hutterer 9fb08310b5 mi: don't process events from disabled devices (#77884)
Once a device is disabled, it doesn't have a sprite pointer anymore. If an
event is still in the queue and processed after DisableDevice finished, a
dereference causes a crash. Example backtrace (crash forced by injecting an
event at the right time):

(EE) 0: /opt/xorg/bin/Xorg (OsSigHandler+0x3c) [0x48d334]
(EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0) [0x37fcc0f74f]
(EE) 2: /opt/xorg/bin/Xorg (mieqMoveToNewScreen+0x38) [0x609240]
(EE) 3: /opt/xorg/bin/Xorg (mieqProcessDeviceEvent+0xd4) [0x609389]
(EE) 4: /opt/xorg/bin/Xorg (mieqProcessInputEvents+0x206) [0x609720]
(EE) 5: /opt/xorg/bin/Xorg (ProcessInputEvents+0xd) [0x4aeb58]
(EE) 6: /opt/xorg/bin/Xorg (xf86VTSwitch+0x1a6) [0x4af457]
(EE) 7: /opt/xorg/bin/Xorg (xf86Wakeup+0x2bf) [0x4af0a7]
(EE) 8: /opt/xorg/bin/Xorg (WakeupHandler+0x83) [0x4445cb]
(EE) 9: /opt/xorg/bin/Xorg (WaitForSomething+0x3fe) [0x491bf6]
(EE) 10: /opt/xorg/bin/Xorg (Dispatch+0x97) [0x435748]
(EE) 11: /opt/xorg/bin/Xorg (dix_main+0x61d) [0x4438a9]
(EE) 12: /opt/xorg/bin/Xorg (main+0x28) [0x49ba28]
(EE) 13: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x37fc821d65]
(EE) 14: /opt/xorg/bin/Xorg (_start+0x29) [0x425e69]
(EE) 15: ? (?+0x29) [0x29]

xf86VTSwitch() calls ProcessInputEvents() before disabling a device, and
DisableDevice() calls mieqProcessInputEvents() again when flushing touches and
button events. Between that and disabling the device (which causes new events
to be refused) there is a window where events may be triggered and enqueued.
On the next call to PIE that event is processed on a now defunct device,
causing the crash.

The simplest fix to this is to discard events from disabled devices. We flush
the queue often enough before disabling that when we get here, we really don't
care about the events from this device.

X.Org Bug 77884 <http://bugs.freedesktop.org/show_bug.cgi?id=77884>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Tested-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-06-04 22:16:28 -07:00
..
Makefile.am dix: Delete mibstore.h 2012-09-23 10:31:55 -07:00
mi.h Make XYToWindow a screen function 2014-04-01 10:30:42 -07:00
miarc.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
mibitblt.c mi: miPutImage with XYPixmap failed at depth 32 on 64-bit machines 2014-03-26 12:58:40 -07:00
micmap.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
micmap.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
micoord.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
micopy.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
micursor.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
midash.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
midispcur.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
mieq.c mi: don't process events from disabled devices (#77884) 2014-06-04 22:16:28 -07:00
miexpose.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
mifillarc.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mifillarc.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mifillrct.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mifpoly.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mifpolycon.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
migc.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
migc.h Clean up a few function prototypes to not place formals in /**/ 2014-01-12 10:24:12 -08:00
miglblt.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
miinitext.c mi: Hush extension initialization (#75870) 2014-03-29 00:01:11 -07:00
miline.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mioverlay.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
mioverlay.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipointer.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
mipointer.h mipointer: Remove deprecated miPointerCurrentScreen 2013-09-10 13:29:21 -04:00
mipointrst.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipoly.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipoly.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipolycon.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipolygen.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipolypnt.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipolyrect.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
mipolyseg.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipolytext.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipolyutil.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mipushpxl.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
miscanfill.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
miscrinit.c Make XYToWindow a screen function 2014-04-01 10:30:42 -07:00
mispans.c mi: fix shadow warnings 2012-11-05 13:25:02 -06:00
mispans.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
misprite.c Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
misprite.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mistruct.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mivalidate.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mivaltree.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
miwideline.c mi: Avoid stack smash when drawing dashed lines 2013-09-10 13:26:25 -04:00
miwideline.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
miwindow.c mi: start calculating the sprite trace from the first child of root 2014-05-08 12:59:19 -07:00
mizerarc.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mizerarc.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mizerclip.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
mizerline.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00