[Jaunty] Pressing any key in onboard crashes xserver with SIGSEGV in CopyKeyClass

Bug #309785 reported by marmuta
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
X.Org X server
Invalid
Medium
xorg-server (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Ubuntu jaunty 9.04 x86_64
xserver-xorg-core 2:1.5.99.3-0ubuntu3

When I run the onscreen keyboard onboard and press any key, X immediately restarts. Sometimes, after a while of working with the system it doesn't crash anymore, so please restart X before testing.
It began after the latest xorg updates to jaunty, never had seen that before.

There is no hint of the crash in the logs, even when NoTrapSignals isn't in xorg.conf.
The gdb backtrace has xorg crashing with SIGSEGV in CopyKeyClass.

Steps to reproduce:
- restart X
- run onboard via menu or terminal
- press any of onboards keys (the backtrace is done with the space key)
[lspci]
01:00.0 VGA compatible controller [0300]: ATI Technologies Inc R430 [Radeon X800 XL] (PCIe) [1002:554d]

Revision history for this message
marmuta (marmuta) wrote :
Revision history for this message
marmuta (marmuta) wrote :
Revision history for this message
marmuta (marmuta) wrote :

lspci -nn | grep VGA

Revision history for this message
marmuta (marmuta) wrote :
Revision history for this message
marmuta (marmuta) wrote :
Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

These have happened to me a lot recently when testing easystroke, but they either occur early in the session or not at all. Not sure where the event comes from, this happens at a time when XAllowEvents(dpy, AsyncPointer) is called on a GrabModeSync core grab and there's also a GrabModeAsync XInput grab being released. For now, I've added a check for master before calling CopyKeyClass.

----

Program received signal SIGSEGV, Segmentation fault.
CopyKeyClass (device=0x9833000, master=0x0) at ../../Xi/exevents.c:201
201 mk = master->key;
(gdb) bt
#0 CopyKeyClass (device=0x9833000, master=0x0) at ../../Xi/exevents.c:201
#1 0x08112137 in mieqProcessInputEvents () at ../../mi/mieq.c:361
#2 0x080c0e27 in ProcessInputEvents ()
    at ../../../../hw/xfree86/common/xf86Events.c:174
#3 0x0808ce36 in Dispatch () at ../../dix/dispatch.c:399
#4 0x08071b6d in main (argc=10, argv=0xbf97cf14, envp=Cannot access memory at address 0x8
)
    at ../../dix/main.c:383
(gdb) print master
$1 = (DeviceIntPtr) 0x0
(gdb) up
#1 0x08112137 in mieqProcessInputEvents () at ../../mi/mieq.c:361
361 CopyKeyClass(dev, master);
(gdb) print dev->isMaster
$2 = 1
(gdb) print event->u.u.type == DeviceKeyPress
$5 = 1
(gdb) print event->u.keyButtonPointer
$6 = {pad00 = 9550, time = 2072921, root = 0, event = 0, child = 0,
  rootX = 655, rootY = 366, eventX = 0, eventY = 0, state = 0,
  sameScreen = 0 '\0', pad1 = 1 '\001'}

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

hmm. looks like the path you're triggering is feeding events into mieqProcessInput events that are directly by the master device.
I think XTest does that in some cases, can you check dix/events.c ProcAllowEvents if there is a similar case (events generated directly on the master device).

Revision history for this message
marmuta (marmuta) wrote :

This problem is probably caused by 154_force-copykeyclass-for-key-events.patch of xserver-xorg-core.

The patch adds
         ChangeDeviceID(mdev, *master);
to CopyKeyClass but doesn't check if master is valid.
Master is NULL in the backtrace, so I guess it segfaults right there.

Luckily there is already a fresh upstream bug report assigned to the patch author:
http://bugs.freedesktop.org/show_bug.cgi?id=19222

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Oh my god, I'm retarded. This has (in my case) nothing to do with pointers at all. What happens is that the application calls XTestFakeKeyEvent after a successful gesture, and if no physical key has been pressed yet during that session, then the master device is the only availabe keyboard, which XTest will use. Now I had to set a breakpoint in mieqEnqueueEvent to figure that out...

Changed in xorg-server:
status: Unknown → In Progress
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

if I'm not mistaken, there should be a replacement for that patch upstream..

Changed in xorg-server:
importance: Undecided → High
status: New → Triaged
Revision history for this message
In , Fdo (fdo) wrote :

This seems to be hitting my packages too.

Any patch to fix yet (nothing it attached here but I get the feeling it's been worked around already).

Revision history for this message
In , Tom Jaeger (thjaeger) wrote :

Created an attachment (id=21617)
patch

This is what I've been using so far.

Revision history for this message
marmuta (marmuta) wrote :

Yes, a patch for the patch.
https://bugs.freedesktop.org/attachment.cgi?id=21617

Just in case someone gets bitten by this in the meantime, there is a workaround. Pressing any key on a real keyboard fixes it for the session.

Revision history for this message
In , Fdo (fdo) wrote :

Created an attachment (id=21653)
A more integrated patch

Thanks for pointing the way :)

I've attached a slightly more integrated patch that groups things up a bit more nicely. It's functionally the same.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

I noticed that it depends on

commit 0b4fef6337d88ae8ef05b8b73941350a9007565c
Author: Peter Hutterer <email address hidden>
AuthorDate: Wed Dec 10 11:35:09 2008 +1000

    dix: move MAX_VALUATOR_EVENTS into include/input.h

Other than that, I think the patch is fine. The MD should have everything set up as it is, so missing the CopyKeyClass shouldn't do anything afoul.
For the future, please include a reference to the bug number in your commit message (I'd appreciate it if you could upload an updated patch for this)

Keith, reassigning to you for pushing onto 1.6.

Revision history for this message
In , Fdo (fdo) wrote :

(In reply to comment #6)
> I noticed that it depends on
>
> commit 0b4fef6337d88ae8ef05b8b73941350a9007565c
> Author: Peter Hutterer <email address hidden>
> AuthorDate: Wed Dec 10 11:35:09 2008 +1000
>
> dix: move MAX_VALUATOR_EVENTS into include/input.h

Ahh yes, sorry I should have noted that here too. I already edited the 1.6 merge wiki page to reflect this :)

Changed in xorg-server:
status: In Progress → Confirmed
Revision history for this message
Francesco Fumanti (frafu) wrote :

Same problem here and I can confirm the work around consisting of pressing a key on a real keyboard. Unfortunately, I assume that most people using an onscreen keyboard don't have access to a real keyboard.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

Created an attachment (id=21891)
0001-mi-Fix-segv-on-CopyKeyClass-19222.patch

updated patch with reference to bug report.

Revision history for this message
In , Peter Hutterer (peter-hutterer) wrote :

As mentioned in Bug 19048 it doesn't really make sense to have a bugreport on top of an uncommited patch in another bugreport. I'm closing this one as a dupe and I merged Colin's patch into the fix for 19048. Thanks for the patch, Colin.

*** This bug has been marked as a duplicate of bug 19048 ***

Revision history for this message
Francesco Fumanti (frafu) wrote :

The xorg-xserver update that occurred a few days ago did not solve this bug yet.

Ubuntu jaunty 9.04 i386
xserver-xorg-core 2:1.5.99.3-0ubuntu4

Bryce Harrington (bryce)
description: updated
Revision history for this message
marmuta (marmuta) wrote :

I've seen the description updated with video card information and I want to point out that this bug is very likely independent on the graphics driver. I can easily reproduce it on real Hardware as well as in VirtualBox.

Revision history for this message
Philip Wyett (philwyett) wrote :

Issue reported by myself in duplicate of this bug (LP 314968) is fixed with 1.5.99.901-0ubuntu1 update.

Revision history for this message
marmuta (marmuta) wrote :

Confirming, todays update to 1.5.99.901-0ubuntu1 fixed the onboard issues too.
Thank you Bryce!

Revision history for this message
Francesco Fumanti (frafu) wrote :

Just updated to xserver-xorg-core 2:1.5.99.901-0ubuntu1 and the issue is now also fixed on my Ubuntu 9.04 i386.
Thanks.

Changed in xorg-server:
status: Triaged → Fix Released
Changed in xorg-server:
status: Confirmed → Invalid
Changed in xorg-server:
importance: Unknown → Medium
status: Invalid → Unknown
Changed in xorg-server:
importance: Medium → Unknown
Changed in xorg-server:
importance: Unknown → Medium
Changed in xorg-server:
status: Unknown → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.