Bug 41653

Summary: Xorg crashes on exit [bisected]
Product: xorg Reporter: Michal Suchanek <hramrach>
Component: Server/DDX/XorgAssignee: Pauli <suokkos>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: blocker    
Priority: highest Keywords: regression
Version: git   
Hardware: Other   
OS: All   
Whiteboard: 2012BRB_Reviewed
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 40982, 44202    
Attachments:
Description Flags
workaround: destroy rotation damage only when screen has a drawable
none
Make sure pScreen isn't NULL none

Description Michal Suchanek 2011-10-10 08:48:17 UTC
Looks like Xorg crashes on exit after 463dd87

To reproduce:

export DISPLAY=:1 ; X :1 & sleep 2 ; dwm &  sleep 1 ; xrandr --output DVI-0 --off ; xrandr --output HDMI-0 --auto --rotate left ; xrandr --output DVI-0 --auto --left-of HDMI-0 ; sleep 3 ; kill %1 

(gdb) bt full
#0  DamageUnregister (pDrawable=0x0, pDamage=0x22da320) at ../../../miext/damage/damage.c:1923
        pScreen = <value optimized out>
        pScrPriv = 0x0
#1  0x00000000004b04cb in xf86RotateDestroy (crtc=0x2036890) at ../../../../hw/xfree86/modes/xf86Rotate.c:308
        pScrn = <value optimized out>
        pScreen = 0x2040c80
        xf86_config = 0x2036700
        c = <value optimized out>
#2  0x00000000004b05d5 in xf86RotateCloseScreen (screen=<value optimized out>)
    at ../../../../hw/xfree86/modes/xf86Rotate.c:344
        scrn = <value optimized out>
        xf86_config = 0x2036700
        c = <value optimized out>
#3  0x00000000004a2182 in xf86CrtcCloseScreen (index=0, screen=0x2040c80) at ../../../../hw/xfree86/modes/xf86Crtc.c:745
        scrn = <value optimized out>
        config = 0x2036700
        o = <value optimized out>
        c = <value optimized out>
#4  0x00000000004c07fb in CursorCloseScreen (index=0, pScreen=0x2040c80) at ../../xfixes/cursor.c:207
        ret = <value optimized out>
        close_proc = <value optimized out>
        display_proc = <value optimized out>
        constrain_proc = <value optimized out>
#5  0x00000000004f498c in AnimCurCloseScreen (index=<value optimized out>, pScreen=<value optimized out>)
    at ../../render/animcur.c:106
        as = 0x2070d60
        ret = <value optimized out>
#6  0x000000000042719f in main (argc=2, argv=<value optimized out>, envp=<value optimized out>) at ../../dix/main.c:327
        i = 0
        alwaysCheckForInput = {0, 1}
Comment 1 Jeremy Huddleston Sequoia 2011-10-10 14:55:16 UTC
http://cgit.freedesktop.org/xorg/xserver/commit/?id=463dd87062edaa974cb8c7163328a53197f237e1

We should fix this or revert before beta1.
Comment 2 Michal Suchanek 2011-10-11 05:47:43 UTC
Created attachment 52211 [details] [review]
workaround: destroy rotation damage only when screen has a drawable
Comment 3 Jeremy Huddleston Sequoia 2011-10-28 18:50:17 UTC
Michal, please send your patch to xorg-devel for review
Comment 4 Jeremy Huddleston Sequoia 2012-03-24 11:47:52 UTC
Have you sent this for review yet?
Comment 5 Michal Suchanek 2012-03-26 07:44:08 UTC
I have your reviewed-by but it was not included in the X server afaik.
Comment 6 Jeremy Huddleston Sequoia 2012-03-28 18:16:32 UTC
It's in my tree and will be in my next [PULL] request.
Comment 7 Knut Petersen 2012-04-07 09:54:16 UTC
The patch has been included in Xorg, but now the xserver segfaults during initialization.

    Backtrace:
    0: /usr/bin/Xorg (xorg_backtrace+0x38) [0x81dc174]
    1: /usr/bin/Xorg (0x8048000+0x1986b3) [0x81e06b3]
    2: (vdso) (__kernel_rt_sigreturn+0x0) [0xb76ef40c]
    3: /usr/bin/Xorg (xf86RotateDestroy+0x34) [0x8106ae0]
    4: /usr/bin/Xorg (xf86CrtcRotate+0x117) [0x8106f10]
    5: /usr/lib/xorg/modules/drivers/intel_drv.so (0xb6e36000+0xcda7) [0xb6e42da7]
    6: /usr/lib/xorg/modules/drivers/intel_drv.so (0xb6e36000+0xd136) [0xb6e43136]
    7: /usr/bin/Xorg (xf86CrtcSetModeTransform+0x1c3) [0x80f63e0]
    8: /usr/bin/Xorg (xf86SetDesiredModes+0x252) [0x80fb2ea]
    9: /usr/lib/xorg/modules/drivers/intel_drv.so (0xb6e36000+0x11ad3) [0xb6e47ad3]
    10: /usr/lib/xorg/modules/drivers/intel_drv.so (0xb6e36000+0x1195a) [0xb6e4795a]
    11: /usr/bin/Xorg (AddScreen+0x248) [0x807aec0]
    12: /usr/bin/Xorg (InitOutput+0xf83) [0x80c4382]
    13: /usr/bin/Xorg (0x8048000+0x1e05b) [0x806605b]
    14: /lib/libc.so.6 (__libc_start_main+0xf3) [0xb70b3003]
    15: /usr/bin/Xorg (0x8048000+0x1dd81) [0x8065d81]

cu,
 Knut
Comment 8 Rico Tzschichholz 2012-04-08 00:25:12 UTC
This change simply add the need to check pScreen for null or make sure it isnt so.
And if this is called during ScreenInit() we don't have pScrn->pScreen yet.

This is already done in xf86CrtcRotate and should be done in xf86RotateDestroy now too.
Comment 9 Rico Tzschichholz 2012-04-08 00:26:10 UTC
Created attachment 59639 [details] [review]
Make sure pScreen isn't NULL
Comment 10 Michal Suchanek 2012-06-13 06:39:58 UTC
fixed in fa6dddc6ce51c1b7a43fb379fb2a19550f6c8683 and ed33772a0d3ace5844e157ae78885ded000819ea

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.