xserver-multidpi/hw
Peter Hutterer f399919e13 xfree86: lock input during PreInit
This is a problem for the libinput driver that uses the same context across
multiple devices. The driver may be halfway through setting up an input device
(and the only way to do so is to add it to libinput) when the input thread
comes in an reads events. This then causes mayhem when data is dereferenced
that hasn't been set up yet.

In my case the cause was the call to libinput_path_remove_device() inside
preinit racing with evdev_dispatch_device() handling of ENODEV. The sequence
was:
- thread 2 gets an event and calls evdev_dispatch_device()
- thread 1 calls libinput_path_remove_device() which sets the device->source
  to NULL
- thread 2 reads from the fd, gets ENODEV and now removes the device->source,
  dereferencing the null-pointer

This is the one I could reproduce the most, but there are other potential
pitfalls that affect any driver that uses the same fd for multiple devices.
Avoid all this and wrap PreInit into the lock.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-08-12 14:43:08 +10:00
..
dmx Switch poll() users to xserver_poll() 2016-07-21 15:04:36 -04:00
kdrive Switch poll() users to xserver_poll() 2016-07-21 15:04:36 -04:00
vfb Remove fd_set from Block/Wakeup handler API 2016-07-18 15:27:51 -04:00
xfree86 xfree86: lock input during PreInit 2016-08-12 14:43:08 +10:00
xnest Remove fd_set from Block/Wakeup handler API 2016-07-18 15:27:51 -04:00
xquartz Remove readmask from screen block/wakeup handler 2016-07-18 15:27:51 -04:00
xwayland Remove fd_set from Block/Wakeup handler API 2016-07-18 15:27:51 -04:00
xwin hw/xwin: Update BlockHandler function signature 2016-07-19 08:10:11 -07:00
Makefile.am Xwayland DDX 2014-04-03 15:19:22 -07:00