Bug 45796

Summary: null pointer dereference in ProcXTestFakeInput when all input devices are disabled
Product: xorg Reporter: Andy Lutomirski <luto>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Andy Lutomirski 2012-02-08 09:56:52 UTC
This is xorg-x11-server-1.11.3-1.fc16 from Fedora 16.

I want to use x11vnc or vino-server in a way that's reasonably secure against attackers sitting at the keyboard.  The best idea I have is to turn off local input devices, like this:

for dev in `xinput list |perl -ane '$_ =~ /id=(\d+)\s/ and print "$1\n"'`; do
    xinput set-prop "$dev" 'Device Enabled' "$1"
done

This works until a remote user actually tries to send input.  Then I get an instant segfault in the server.  gdb says:

Program received signal SIGSEGV, Segmentation fault.
0x00000000004db52e in ProcXTestFakeInput (client=0x2057c60) at xtest.c:375
375	            if (!dev->valuator)
(gdb) bt
#0  0x00000000004db52e in ProcXTestFakeInput (client=0x2057c60) at xtest.c:375
#1  0x0000000000433ae1 in Dispatch () at dispatch.c:447
#2  0x0000000000422e15 in main (argc=<optimized out>, argv=0x7fff821baa48, 
    envp=<optimized out>) at main.c:287
(gdb) list
370	            }
371	
372	            need_ptr_update = 0;
373	            break;
374	        case MotionNotify:
375	            if (!dev->valuator)
376	                return BadDevice;
377	
378	            if (!(extension || ev->u.keyButtonPointer.root == None))
379	            {
(gdb) print dev
$1 = (DeviceIntPtr) 0x0


(It would be nice to have a better way to do this.  For example, turning off all non-Xtest input and setting dpms off *without telling client software that dpms is off* so that the compositor continues to draw things.)
Comment 1 Peter Hutterer 2012-02-15 21:15:30 UTC
Proposed patch: http://patchwork.freedesktop.org/patch/9116/
Comment 2 Jeremy Huddleston Sequoia 2012-06-12 03:58:59 UTC
This is fixed on 1.12.1

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.