Bug 15936 - [mpx branch] Mouse grab crashes X: "Bad valuators reported"
Summary: [mpx branch] Mouse grab crashes X: "Bad valuators reported"
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/Input/Core (show other bugs)
Version: git
Hardware: All Linux (All)
: medium normal
Assignee: Peter Hutterer
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-14 13:57 UTC by Brian Rogers
Modified: 2008-05-16 18:07 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Log of the crash with ppracer (21.46 KB, text/plain)
2008-05-14 14:11 UTC, Brian Rogers
no flags Details
Backtrace of crash while running dosbox (729 bytes, text/plain)
2008-05-15 15:27 UTC, Brian Rogers
no flags Details
Fix (569 bytes, patch)
2008-05-15 16:34 UTC, Brian Rogers
no flags Details | Splinter Review
Full fix (958 bytes, patch)
2008-05-15 16:41 UTC, Brian Rogers
no flags Details | Splinter Review

Description Brian Rogers 2008-05-14 13:57:44 UTC
This bug affects the mpx branch and I've verified that it does not occur in the
master branch.

If I open dosbox and hit ctrl-F10, it grabs the cursor so that the mouse controls the DOS program. If I do this on the mpx branch, X crashes, and the log contains the following:

[mi] Unknown event type, cannot change id.

Fatal server error:
Bad valuators reported for device ImPS/2 Logitech Wheel Mouse

That device is the touchpad on my laptop. This crash happens even with only one core pointer.

Another program that triggers the same crash is Planet Penguin Racer. There it happens once I start a race. When it crashes from ppracer, the 'unknown event type' message is repeated in the log about a hundred times before the crash. I believe that message is being spewed out while I am navigating the menus before I start a race. I'll attach a log file of this.
Comment 1 Brian Rogers 2008-05-14 14:11:06 UTC
Created attachment 16539 [details]
Log of the crash with ppracer

Here's a log of X crashing from ppracer. This time it crashed almost immediately rather than waiting for me to start a race, so the 'Unknown event type' message only appears once.
Comment 2 Peter Hutterer 2008-05-14 19:24:40 UTC
I can't reproduce these. The fact that its dosbox and ppracer indicates it might be DGA related. I also tried xmoto, but nothing.

When did you pull? I had bugs like this before but they were fixed with commit ec2fca7e6f7ce8fdf33d959b7adeaae935ec4b37 (29.april).


Comment 3 Brian Rogers 2008-05-15 13:56:48 UTC
I'm fully up to date (68b4f250eef441a3d75e3b9b2665a51d3a1538d6).

I just tried xmoto. It will crash if I run it fullscreen, but not in a window. Turns out ppracer is the same.

So far, dosbox is the only thing that crashes X while running in a window.
Comment 4 Brian Rogers 2008-05-15 15:27:49 UTC
Created attachment 16557 [details]
Backtrace of crash while running dosbox

I attached gdb, set a breakpoint on FatalError, and got a backtrace. Here it is.
Comment 5 Brian Rogers 2008-05-15 16:02:30 UTC
Here's the relevant data at frame 1 in the backtrace:
xV->first_valuator = 69
xV->num_valuators = 86
v->numAxes = 2

Then, of course, 69+86 > 2.
Comment 6 Brian Rogers 2008-05-15 16:07:30 UTC
Those numbers were suspiciously in the ASCII range, so I tried this:
(gdb) x/s xV
0xa38410:        "ONE_LEVEL"

There's a string there instead of the correct data structure!
Comment 7 Brian Rogers 2008-05-15 16:15:48 UTC
Figured it out.

Line 1093 in hw/xfree86/common/xf86DGA.c

UpdateDeviceState is called specifying two parameters, but it takes three, therefore count doesn't get initialized and the loop goes out of range.
Comment 8 Brian Rogers 2008-05-15 16:34:07 UTC
Created attachment 16560 [details] [review]
Fix

If I understand correctly, count should always be 1 here. This change stopped the crashing.
Comment 9 Brian Rogers 2008-05-15 16:41:36 UTC
Created attachment 16561 [details] [review]
Full fix

Always good to grep for other occurrences of the same mistake...
Comment 10 Peter Hutterer 2008-05-15 17:41:03 UTC
(In reply to comment #7)
> Figured it out.
> 
> Line 1093 in hw/xfree86/common/xf86DGA.c
> 
> UpdateDeviceState is called specifying two parameters, but it takes three,
> therefore count doesn't get initialized and the loop goes out of range.
> 

d'oh! thanks, applied! will be pushed soon.
Comment 11 Peter Hutterer 2008-05-16 18:07:59 UTC
pushed as 5127942f80983b2e053dddd5c5747d0c3d2f9d6d.


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.