Bug 7498

Summary: XGL crashes with evdev mouse due to too many buttons
Product: xorg Reporter: Sven Lilienthal <bugs>
Component: Server/Acceleration/XGLAssignee: David Reveman <reveman>
Status: RESOLVED WONTFIX QA Contact: Xorg Project Team <xorg-team>
Severity: critical    
Priority: high CC: mark
Version: gitKeywords: have-backtrace
Hardware: x86 (IA32)   
OS: Linux (All)   
i915 platform: i915 features:
Description Flags
strace output on archlinux compiled for x86
strace output on archlinux compiled for x86 none

Description Sven Lilienthal 2006-07-12 01:50:53 UTC
When starting Xgl, it segfaults. Bugs seems to be caused by evdev recognizing my
keyboard and mouse not 100% correctly and assigning the multimedia-keys of my
keyboard as mouse buttons, resulting in 99 buttons. MAX_BUTTONS is set to 64 in
hw/xgl/glx/xglx.c , setting it to 99 fixes this bug.

Stack trace:
(gdb) start :1
Breakpoint 1 at 0x80a7ae0: file main.c, line 255.
Starting program: /opt/Xgl/bin/Xgl :1
main (argc=2, argv=0xbfc7d444, envp=0xbfc7d450) at main.c:255
255         display = "0";
(gdb) continue
[Thread debugging using libthread_db enabled]
[New Thread -1211271488 (LWP 32351)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211271488 (LWP 32351)]
0x080863ab in InitButtonClassDeviceStruct (dev=0x44434241, numButtons=99,
map=0xbfc7d2e7 "") at devices.c:590
590         dev->button = butc;
(gdb) bt
#0  0x080863ab in InitButtonClassDeviceStruct (dev=0x44434241, numButtons=99,
map=0xbfc7d2e7 "") at devices.c:590
#1  0x08086b43 in InitPointerDeviceStruct (device=0x44434241, map=0xbfc7d2e7 "",
    motionProc=0x81190fa <miPointerGetMotionEvents>, controlProc=0xb798f16e
<xglxChangePointerControl>, numMotionEvents=256)
    at devices.c:813
#2  0xb798f282 in xglxPointerProc (pDevice=0x82f8bc8, onoff=0) at xglx.c:1325
#3  0x08085376 in InitAndStartDevices () at devices.c:177
#4  0x080a7fdf in main (argc=2, argv=0xbfc7d444, envp=0xbfc7d450) at main.c:400
Comment 1 Daniel Stone 2007-02-27 01:32:53 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 2 Marckus M. van Dijk 2007-06-25 18:30:59 UTC
I can partially confirm, and reproduce this bug. Not sure if it only involves XGL. Nor am I sure if it can be fixed as proposed elsewhere in the bug comments.

When I perform "X" from the command line, the submitted strace occurs using the following configuration after which X segfaults (or so the strace says..). Originally I suspected it to be my own fault due to custom CFLAGS, but I can reproduce this on more than one linux distribution (gentoo and archlinux) which removes that possibility.

Section "InputDevice"
	Identifier  "TrackManOptical"
	Driver      "evdev"
	Option	    "Protocol" "Auto"
	    # cat /proc/bus/input/devices
	Option	    "Dev Name" "Logitech USB Receiver"
	Option	    "Dev Phys" "usb-0000:00:02.1-3/input0"
	    # May use /dev/input/mice instead, but I have two USB mice.
	Option	    "Device" "/dev/input/event2"
	Option	    "Buttons" "10"
	Option	    "ZAxisMapping" "4 5 6 7 8 9 10"
	    # This will make the button 8 the "lock" modifier.
	Option	    "DragLockButtons" "8"
	Option	    "AngleOffset" "-7"
Comment 3 Marckus M. van Dijk 2007-06-25 18:32:08 UTC
Created attachment 10449 [details]
strace output on archlinux compiled for x86
Comment 4 Marckus M. van Dijk 2007-06-25 18:32:57 UTC
Created attachment 10450 [details]
strace output on archlinux compiled for x86

(This time uploaded with proper headers)
Comment 5 Marckus M. van Dijk 2007-06-25 18:35:17 UTC
The bug can _not_ be reproduced by:

Section "InputDevice"
	Identifier  "Keyboard1"
	Driver      "evdev"
	Option	    "Protocol" "evdev"
	Option	    "Device" "/dev/input/event0"
	Option	    "XkbModel" "microsoftnek4k"
	Option	    "XkbLayout" "dvorak"
	Option	    "XkbOptions" "ctrl:swapcaps,altwin:super_win"
	#Option	    "XkbOptions" "ctrl:swapcaps"

Because when commenting out the mouse section, but not this section, X does load.
Comment 6 Adam Jackson 2009-06-12 09:48:16 UTC
Mass closure: XGL is gone, these are never getting fixed.

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.