[PATCH xserver] Xi: Hold the input lock when sending events

Olivier Fourdan ofourdan at redhat.com
Wed Feb 22 15:16:32 UTC 2017


Hi,

> 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(+)

That doesn't fix the issue, unfortunately. But I am convinced the problem comes from calling eventually WriteToClients() from the InputThread, which can lead to various memory corruption either from the input or output buffers or from the CallCallbacks() as seen in some of the backtraces.

So I'm tempted to put all that code within its own mutex so it's protected from concurrent access.

I have a patch for and the first tests seems to show it avoids the crash, I've been testing it successfully for several minutes whereas before it would crash whithin seconds with my reproducer steps. Of course it's not a proof, but...

I'll post that patch as an RFC...

Cheers,
Olivier


More information about the xorg-devel mailing list