[Bug 604966] New: vmmouse_detect seg faults at vmmouse_proto.c:62
http://bugzilla.novell.com/show_bug.cgi?id=604966 http://bugzilla.novell.com/show_bug.cgi?id=604966#c0 Summary: vmmouse_detect seg faults at vmmouse_proto.c:62 Classification: openSUSE Product: openSUSE 11.3 Version: Factory Platform: x86-64 OS/Version: openSUSE 11.3 Status: NEW Severity: Normal Priority: P5 - None Component: X.Org AssignedTo: bnc-team-xorg-bugs@forge.provo.novell.com ReportedBy: lchiquitto@novell.com QAContact: xorg-maintainer-bugs@forge.provo.novell.com Found By: --- Blocker: --- I'm seeing these core files around (probably one generated on each boot). Core was generated by `/usr/bin/vmmouse_detect'. Program terminated with signal 11, Segmentation fault. #0 0x00000000004007d8 in VMMouseProtoInOut (cmd=0x0) at vmmouse_proto.c:62 62 __asm__ __volatile__( (gdb) list 57 VMMouseProtoInOut(VMMouseProtoCmd *cmd) // IN/OUT 58 { 59 #ifdef __x86_64__ 60 uint64_t dummy; 61 62 __asm__ __volatile__( 63 "pushq %%rax" "\n\t" 64 "movq 40(%%rax), %%rdi" "\n\t" 65 "movq 32(%%rax), %%rsi" "\n\t" 66 "movq 24(%%rax), %%rdx" "\n\t" gdb) bt #0 0x00000000004007d8 in VMMouseProtoInOut (cmd=0x0) at vmmouse_proto.c:62 #1 VMMouseProto_SendCmd (cmd=0x0) at vmmouse_proto.c:146 #2 0x0000000000000000 in ?? () -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c1
--- Comment #1 from Leonardo Chiquitto
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c
Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c3
Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c4
--- Comment #4 from Leonardo Chiquitto
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c5
--- Comment #5 from Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c6
Leonardo Chiquitto
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c7
Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c8
Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c9
Andreas Jaeger
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c10
Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c11
--- Comment #11 from Leonardo Chiquitto
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c12
--- Comment #12 from Stefan Dirsch
Created an attachment (id=366092) --> (http://bugzilla.novell.com/attachment.cgi?id=366092) [details] suggested patch
Although I can't explain why, this patch resolves the problem for me.
Subject: Not calling iopl() is triggering an undesired SEGV
References: bnc#604966
Reverts the following upstream commit:
commit bcdec3d0cd4434770cd841c33c030e0d7203881f
Author: Philip Langdale
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c13
--- Comment #13 from Leonardo Chiquitto
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c14
--- Comment #14 from Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c15
Michel Dänzer
Anyway, the issue here was slightly convoluted. The standard detection mechanism we use has always been to do this port-poke, and if it's not a VM, you get a segfault - and you do need iopl() set to allow that to work. When I published the vmmouse source, I had the iopl() call in there and that was an issue for non-Linux operating systems, but I also observed that it wasn't really necessary because the X server did iopl() itself - not really a surprise. Later on, I added vmmouse_detect to allow the HAL/udev based device detection to work, and those are standalone and so what the X server does is irrelevant.
Now, why isn't this an issue for anyone else? It does the detection correctly on Ubuntu and other distros (and no one cares about the segfault in the failure case). I guess they have funny core handling going on?
Anyway, it seems the right fix is to add the iopl() call in, perhaps only in vmmouse_detect as it's still irrelevant in the X server. It also doesn't matter in the X server now as the driver isn't loaded unless the device is detected.
It also needs to be properly guarded for LINUX. Who knows what's up on BSD or similar.
-- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c16
Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c17
--- Comment #17 from Andreas Jaeger
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c18
Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c19
Andreas Jaeger
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c20
--- Comment #20 from Andreas Jaeger
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c21
Kay Sievers
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c22
--- Comment #22 from Leonardo Chiquitto
Leonardo, if you fix the Sig11 on a non-VWware virtual machine, the program behaves the same as in a VWware virtual machine. But the idea was to segfault and then exit(1) instead of exit(0).
I tested this only in a physical machine and the detection seems to work without the SEGV: # /usr/bin/vmmouse_detect # echo $? 1 -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c23
--- Comment #23 from Stefan Dirsch
Leonardo, if you fix the Sig11 on a non-VWware virtual machine, the program behaves the same as in a VWware virtual machine. But the idea was to segfault and then exit(1) instead of exit(0).
I tested this only in a physical machine and the detection seems to work without the SEGV:
# /usr/bin/vmmouse_detect # echo $? 1
You don't see the segfault, because there is a signal handler for SIG11. In that signal handler there is the exit(1) call. This is done by intention. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c24
Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c25
--- Comment #25 from Kay Sievers
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c26
--- Comment #26 from Kay Sievers
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c27
--- Comment #27 from Kay Sievers
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c28
--- Comment #28 from Leonardo Chiquitto
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c29
--- Comment #29 from Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c30
--- Comment #30 from Stefan Dirsch
Can someone please try if that doesn't tell if it's a vmware guest? grep . /sys/class/dmi/id/*
Leonardo, any chance to provide this information? I'm asking you, since according to comment #28 you have/had access to a vmware guest. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c31
--- Comment #31 from Michel Dänzer
I have no objection to putting the iopl() call back in, as long as it's properly guarded for Linux (obviously).
Second, Kay's grumbling about using dmi. I actually had a dmi test in there originally but I removed it because the qemu/kvm people got sulky.
http://cgit.freedesktop.org/xorg/driver/xf86-input-vmmouse/commit/?id=b29b45...
-- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c32
Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c33
Stefan Dirsch
Second, Kay's grumbling about using dmi. I actually had a dmi test in there originally but I removed it because the qemu/kvm people got sulky.
http://cgit.freedesktop.org/xorg/driver/xf86-input-vmmouse/commit/?id=b29b45...
Indeed I remember that qemu/kvm want to make use of vmmouse as well. Maybe agraf has an idea how to detect a vmware/qemu virtual machine in a different way, i.e. by avoiding a segfault. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c34
--- Comment #34 from Alexander Graf
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c35
--- Comment #35 from Stefan Dirsch
FWIW probing the port is the only reliable method to probe for the vmport. So we _have_ to take the segfault. Btw if intercepting segfaults breaks the boehm garbage collector would break too, no?
Thanks for the input, Alex. I couldn't understand the second sentence though. Could you rephrase it? AFAICS this is becoming a WONTFIX after all. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c36
--- Comment #36 from Alexander Graf
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c37
--- Comment #37 from Leonardo Chiquitto
AFAICS this is becoming a WONTFIX after all.
Why WONTFIX? For me this is already FIXED (request #41093 was accepted). -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c38
--- Comment #38 from Stefan Dirsch
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c39
--- Comment #39 from Leonardo Chiquitto
http://bugzilla.novell.com/show_bug.cgi?id=604966
http://bugzilla.novell.com/show_bug.cgi?id=604966#c40
Andreas Jaeger
participants (1)
-
bugzilla_noreply@novell.com