[PATCH xserver] Xi: Hold the input lock when sending events
Peter Hutterer
peter.hutterer at who-t.net
Wed Feb 22 23:00:32 UTC 2017
On Wed, Feb 22, 2017 at 10:48:24AM +0100, Olivier Fourdan wrote:
> Otherwise the output buffer will be accessed from different threads and
> cause all sorts of nasty and painful memory corruptions.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99164
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99887
> Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
> ---
> Xi/xiproperty.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
> index b7a1f59..a68b4b3 100644
> --- a/Xi/xiproperty.c
> +++ b/Xi/xiproperty.c
> @@ -203,10 +203,12 @@ send_property_event(DeviceIntPtr dev, Atom property, int what)
> .what = what
> };
>
> + input_lock();
> SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent *) &event, 1);
>
> SendEventToAllWindows(dev, GetEventFilter(dev, (xEvent *) &xi2),
> (xEvent *) &xi2, 1);
> + input_unlock();
I don't think that's correct. The input thread is for event *generation*,
not processing events which is still done in the event queue. It replaces
the old sigio handler.
I don't think anything gets here from within the input thread, does it? If
so, that's the bug to fix.
Cheers,
Peter
> }
>
> static int
> --
> 2.9.3
More information about the xorg-devel
mailing list