Bug 10683 - clients crash when Xinput device used
Summary: clients crash when Xinput device used
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/Input/Core (show other bugs)
Version: 7.1 (2006.05)
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Daniel Stone
QA Contact: Xorg Project Team
Depends on:
Blocks: xorg-server-1.4.1
  Show dependency treegraph
Reported: 2007-04-19 15:03 UTC by Mark Vytlacil
Modified: 2007-12-27 19:39 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Description Mark Vytlacil 2007-04-19 15:03:42 UTC
This discovered using gimp and the latest aiptek tablet driver from the aiptek svn, but it probably effects other devices as well. Gimp or some other client crashes at random times while drawing with the device. The bug also probably effects 7.2. I am not sure about git. A patch is submitted below.

This is the explanation of the bug and patch: Read() from the client connection often returns with an EAGAIN error. Other errors are considered fatal and the server closes the connection and the client crashes. If a signal from the Xinput device happens between the read() call and the check of errno, the signal handler does other system calls which trash errno. The patch is to the signal handler.

I hope that this is helpful.

diff -ru xorg-server-X11R7.1-1.1.0/hw/xfree86/common/xf86Events.c my_xorg-server-X11R7.1-1.1.0/hw/xfree86/common/xf86Events.c
--- xorg-server-X11R7.1-1.1.0/hw/xfree86/common/xf86Events.c	2006-03-25 13:52:03.000000000 -0600
+++ my_xorg-server-X11R7.1-1.1.0/hw/xfree86/common/xf86Events.c	2007-04-16 15:10:52.000000000 -0500
@@ -1230,12 +1230,14 @@
 xf86SigioReadInput(int fd,
 		   void *closure)
+    int err_save = errno;
     int sigstate = xf86BlockSIGIO();
     InputInfoPtr pInfo = (InputInfoPtr) closure;
+    errno = err_save;
Comment 1 Daniel Stone 2007-04-19 15:27:33 UTC
thanks for your analysis!
Comment 2 Mark Vytlacil 2007-04-19 18:21:03 UTC
As an amateur, I am pretty proud of myself for running this down, but I just realized that my patch completely ignores the distinction between os dependent and independent code.
Comment 3 Daniel Stone 2007-04-20 00:53:18 UTC
i think every platform we have uses errno.  if not, it's a relatively simple matter to wrap it in #ifdef HAVE_ERRNO.
Comment 4 Paolo Acam 2007-10-28 05:27:46 UTC
It seems to solve my troubles with my trust400-v2 (aiptek driver), I applied the patch, now applications don't crash anymore.
Comment 5 cem 2007-10-28 11:37:54 UTC
i also applied the patch, it solved my crash problem, thanks.
Comment 6 Daniel Stone 2007-11-04 08:28:54 UTC
pushed to master and input-fixes-for-1.4.1.
Comment 7 Stefan Murawski 2007-12-27 14:52:02 UTC
(In reply to comment #6)
> pushed to master and input-fixes-for-1.4.1.

Does that mean it will be included in 1.4.1? Or does it still need to be approved?
If so, take my vote for inclusion. I also got an aiptek-based tablet and last time I used the driver, about 2 months ago, it kept crashing the Xserver and random applications.
Comment 8 Daniel Stone 2007-12-27 19:39:58 UTC
it's already included in and will also be in 1.4.1.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.