Bug 107570

Summary: crashes on keyboard remapping
Product: xorg Reporter: Samuel Thibault <samuel.thibault>
Component: Server/Input/CoreAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: 7.7 (2012.06)   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
trigger program
none
xinitrc script to run the session
none
Xorg log
none
simpler reproducer none

Description Samuel Thibault 2018-08-14 22:14:08 UTC
Created attachment 141089 [details]
trigger program

Hello,

We are observing an X server crash when at-spi's registryd remaps the keyboard layout to simulate keypresses. I'm attaching here the program to reproduce the issue, and I will attach the .xinitrc I am using to start it, and the Xorg log.

Samuel
Comment 1 Samuel Thibault 2018-08-14 22:17:19 UTC
Created attachment 141090 [details]
xinitrc script to run the session

Here is the xinitrc script that I am using to run the session in which to run the trigger program. So basically I run

startx $PWD/xinitrc

which starts Xorg, the dbus bus, the at-spi2 daemons, and runs xterm, and in the xterm, I run the generate_keyboard_event.py script.

Interestingly, in my original .xinitrc, I had a setxkbmap call early in the script, to work around https://bugs.freedesktop.org/show_bug.cgi?id=26402 . It happens that this makes the crash not to happen. So possibly this bug is related to 26402.
Comment 2 Samuel Thibault 2018-08-14 22:22:57 UTC
Created attachment 141091 [details]
Xorg log

And here is the Xorg log, and here are the actual lines:

0x1b38dd is in xorg_backtrace (../../../../os/backtrace.c:127).
127	    for (i = 0; i < size; i++) {
0x1b7599 is in OsSigHandler (../../../../os/osinit.c:138).
135	    xorg_backtrace();
138	    if (sip->si_code == SI_USER) {
0x153ddd is in _XkbSetMapChecks (../../../../xkb/xkb.c:2387).
2387	    xkb = xkbi->desc;
0x15b37f is in ProcXkbSetMap (../../../../xkb/xkb.c:2656).
2655	            rc = _XkbSetMapChecks(client, other, stuff, tmp);
2656	            if (rc != Success)
0x5b008 is in Dispatch (../../../../dix/dispatch.c:478).
476	                    result = XaceHookDispatch(client, client->majorOp);
477	                    if (result == Success)

so it seems like an issue within xkb.
Comment 3 Samuel Thibault 2018-08-14 22:29:54 UTC
And to explain what at-spi's registryd is doing, it is basically changing one keycode of the keymap temporarily to be able to simulate through XTest any keysym, even if not currently available in the current keyboard map. One can read that in 

https://gitlab.gnome.org/GNOME/at-spi2-core/blob/master/registryd
/deviceeventcontroller-x11.c#L693

which looks for a keycode which will not pose problem

https://gitlab.gnome.org/GNOME/at-spi2-core/blob/master/registryd/deviceeventcontroller-x11.c#L211

which checks whether the keysym is available somewhere in the keyboard map.

https://gitlab.gnome.org/GNOME/at-spi2-core/blob/master/registryd/deviceeventcontroller-x11.c#L164

which does the actual temporary change.
Comment 4 Samuel Thibault 2018-08-14 22:42:38 UTC
Created attachment 141093 [details]
simpler reproducer

Here is a simpler reproducer, just copy/pasted from at-spi's registryd. Now I can just run

startx /usr/bin/xterm

and run ./remap in the xterm, and get the same crash.
Comment 5 GitLab Migration User 2018-12-17 17:27:15 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/574.

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.