Bug 27114

Summary: xorg crashes when resuming from suspend to ram
Product: xorg Reporter: Michael Stapelberg <michael+freedesktop>
Component: Server/DDX/XorgAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: 7.5 (2009.10)   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 27592    
Attachments:
Description Flags
Proposed patch to eliminate potential loop in EnterVT function pointer none

Description Michael Stapelberg 2010-03-16 12:14:28 UTC
When resuming from suspend to RAM, x.org sometimes (!) crashes. Enabling core-dumps and using gdb reveals what looks like an endless loop in hw/xfree86/modes/xf86RandR12.c:xf86RandR12EnterVT. Rebuilding the Xserver after commenting out line 1792 of the same file (pScrn->EnterVT = xf86RandR12EnterVT;) helps (it does not requery screens after resume, then, but at least it does not crash).

Probably worth noting is that I run the i3 window manager in the latest version, in which it is RandR-aware and receives screenchange, outputchange, crtcchange and outputproperty RandR events, so maybe it is necessary to select these events to trigger the bug.

X.org version is 1.7.5.902, log contains no messages related to this crash (xorg just segfaults). Driver is intel 2.9.1, hardware a ThinkPad x200 with Intel® GM45 graphics card.

Please let me know if you need any more information.
Comment 1 Victor Stinner 2010-04-27 02:50:16 UTC
I have the same crash with the same video driver (Intel 2.9.1) on Debian Sid. The crash is a stack overflow caused by an unlimited recursion loop in xf86RandR12EnterVT(): randrp->orig_EnterVT==xf86RandR12EnterVT. It crashs after the 174704-th call to xf86RandR12EnterVT() :-)

Backtrace:

(gdb) where
#0  0x08075c92 in dixLookupPrivate (privates=0x85fd1a0, key=0x81f5f14) at ../../dix/privates.c:159
#1  0x0818c3df in xf86RandR12EnterVT (screen_index=0, flags=0) at ../../../../hw/xfree86/modes/xf86RandR12.c:1757
#2  0x0818c3f2 in xf86RandR12EnterVT (screen_index=0, flags=0) at ../../../../hw/xfree86/modes/xf86RandR12.c:1760
#3  0x0818c3f2 in xf86RandR12EnterVT (screen_index=0, flags=0) at ../../../../hw/xfree86/modes/xf86RandR12.c:1760
#4  0x0818c3f2 in xf86RandR12EnterVT (screen_index=0, flags=0) at ../../../../hw/xfree86/modes/xf86RandR12.c:1760
#5  0x0818c3f2 in xf86RandR12EnterVT (screen_index=0, flags=0) at 
...
#174702 0x0818c3f2 in xf86RandR12EnterVT (screen_index=0, flags=0) at ../../../../hw/xfree86/modes/xf86RandR12.c:1760
#174703 0x0818c3f2 in xf86RandR12EnterVT (screen_index=0, flags=0) at ../../../../hw/xfree86/modes/xf86RandR12.c:1760
#174704 0x08188ad1 in xf86XVEnterVT (index=0, flags=0) at ../../../../hw/xfree86/common/xf86xv.c:1232
#174705 0xb7353154 in glxDRIEnterVT (index=0, flags=0) at ../../glx/glxdri2.c:520
#174706 0x080bb5db in xf86VTSwitch (blockData=0x0, err=-1, pReadmask=0x81f7140)
    at ../../../../hw/xfree86/common/xf86Events.c:548
#174707 xf86Wakeup (blockData=0x0, err=-1, pReadmask=0x81f7140) at ../../../../hw/xfree86/common/xf86Events.c:299
#174708 0x08094c12 in WakeupHandler (result=-1, pReadmask=0x81f7140) at ../../dix/dixutils.c:413
#174709 0x080a61aa in WaitForSomething (pClientsReady=0x886d590) at ../../os/WaitFor.c:232
#174710 0x0807fdc0 in Dispatch () at ../../dix/dispatch.c:375
#174711 0x0806697a in main (argc=8, argv=0xbf97ea34, envp=0xbf97ea58) at ../../dix/main.c:285

Packages' versions:

marge$ dpkg -l|grep xorg
ii  xserver-xorg                         1:7.5+5                    the X.Org X server
ii  xserver-xorg-core                    2:1.7.6.901-3              Xorg X server - core server
ii  xserver-xorg-core-dbg                2:1.7.6.901-3              Xorg - the X.Org X server (debugging symbols)
ii  xserver-xorg-input-all               1:7.5+5                    the X.Org X server -- input driver metapackage
ii  xserver-xorg-input-evdev             1:2.3.2-6                  X.Org X server -- evdev input driver
ii  xserver-xorg-input-synaptics         1.2.2-2                    Synaptics TouchPad driver for X.Org server
ii  xserver-xorg-input-wacom             0.10.5+20100416-1          X.Org X server -- Wacom input driver
ii  xserver-xorg-video-apm               1:1.2.2-1                  X.Org X server -- APM display driver
ii  xserver-xorg-video-ark               1:0.7.2-1                  X.Org X server -- ark display driver
ii  xserver-xorg-video-ati               1:6.13.0-1                 X.Org X server -- AMD/ATI display driver wrapper
ii  xserver-xorg-video-chips             1:1.2.2-1                  X.Org X server -- Chips display driver
ii  xserver-xorg-video-cirrus            1:1.3.2-1                  X.Org X server -- Cirrus display driver
ii  xserver-xorg-video-fbdev             1:0.4.2-1                  X.Org X server -- fbdev display driver
ii  xserver-xorg-video-i128              1:1.3.3-1                  X.Org X server -- i128 display driver
ii  xserver-xorg-video-i740              1:1.3.2-1                  X.Org X server -- i740 display driver
ii  xserver-xorg-video-intel             2:2.9.1-3                  X.Org X server -- Intel i8xx, i9xx display driver
ii  xserver-xorg-video-mach64            6.8.2-2                    X.Org X server -- ATI Mach64 display driver
ii  xserver-xorg-video-mga               1:1.4.11.dfsg-2            X.Org X server -- MGA display driver
ii  xserver-xorg-video-neomagic          1:1.2.4-2                  X.Org X server -- Neomagic display driver
ii  xserver-xorg-video-nv                1:2.1.17-2                 X.Org X server -- NV display driver
rc  xserver-xorg-video-openchrome        1:0.2.904+svn812-1         X.Org X server -- VIA display driver
ii  xserver-xorg-video-r128              6.8.1-2                    X.Org X server -- ATI r128 display driver
ii  xserver-xorg-video-radeon            1:6.13.0-1                 X.Org X server -- AMD/ATI Radeon display driver
ii  xserver-xorg-video-radeonhd          1.3.0-2                    X.Org X server -- AMD/ATI r5xx, r6xx display driver
ii  xserver-xorg-video-rendition         1:4.2.3-1                  X.Org X server -- Rendition display driver
ii  xserver-xorg-video-s3                1:0.6.3-1                  X.Org X server -- legacy S3 display driver
ii  xserver-xorg-video-s3virge           1:1.10.4-1                 X.Org X server -- S3 ViRGE display driver
ii  xserver-xorg-video-savage            1:2.3.1-1                  X.Org X server -- Savage display driver
ii  xserver-xorg-video-siliconmotion     1:1.7.3-1                  X.Org X server -- SiliconMotion display driver
ii  xserver-xorg-video-sis               1:0.10.2-2                 X.Org X server -- SiS display driver
ii  xserver-xorg-video-sisusb            1:0.9.3-1                  X.Org X server -- SiS USB display driver
ii  xserver-xorg-video-tdfx              1:1.4.3-1                  X.Org X server -- tdfx display driver
ii  xserver-xorg-video-trident           1:1.3.3-1                  X.Org X server -- Trident display driver
ii  xserver-xorg-video-tseng             1:1.2.3-1                  X.Org X server -- Tseng display driver
ii  xserver-xorg-video-v4l               1:0.2.0-4                  X.Org X server -- Video 4 Linux display driver
ii  xserver-xorg-video-vesa              1:2.3.0-1                  X.Org X server -- VESA display driver
ii  xserver-xorg-video-vmware            1:11.0.1-1                 X.Org X server -- VMware display driver
ii  xserver-xorg-video-voodoo            1:1.2.3-1                  X.Org X server -- Voodoo display driver

CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz (with hyperthreading enabled: 2 virtual cores)

Do you new extra information?
Comment 2 Victor Stinner 2010-04-27 02:53:47 UTC
Oh, I forget some details:
 - I switched from Xorg to text mode and then from the text mode to Xorg => crash
 - A few minutes before the crash, I lost my keyboard (the mouse was still working, but not the keyboard). I got "Device reopened after 1 attempts." messages for all inputs (Power Button, Logitech USB Receiver, Dell Dell USB Keyboard). This bug may be related to #21141 but I'm not sure that both bugs (Xorg crash on VT switch and loosing the keyboard) are related

Xorg crash occurs sometimes, it's not easy to reproduce it :-/
Comment 3 Keith Packard 2010-05-07 22:58:51 UTC
I've sent a proposed patch for this to xorg-devel marked with this bug number (27114)
Comment 4 Keith Packard 2010-05-12 11:31:42 UTC
Created attachment 35598 [details] [review]
Proposed patch to eliminate potential loop in EnterVT function pointer

Please test this patch and report back whether it resolves the bug for you, otherwise it's not going to get into the next server release.
Comment 5 Michael Stapelberg 2010-05-14 13:25:20 UTC
Thanks for your patch, Keith. I’ve applied it on my notebook and will report back in a week if I noticed any problems -- the first few suspends did not show any problems.
Comment 6 Michael Stapelberg 2010-05-21 15:11:55 UTC
I have been using the patched version since my last comment and I did not run into this crash during this time. So, please merge this patch.
Comment 7 Keith Packard 2010-06-15 14:41:44 UTC
Thanks, the fix is in version 68a9ee8370e6f9b38218376ac92d5130a5b0ef1e

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.