Bug 93415

Summary: Xorg crashes under Zaphod mode when adding/removing display (bisected)
Product: xorg Reporter: James Le Cuirot <chewi>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: airlied
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg.0.log
none
Handle Zaphod mode correctly in radeon_mode_hotplug none

Description James Le Cuirot 2015-12-16 21:58:30 UTC
Created attachment 120553 [details]
Xorg.0.log

When I turn my HDMI-connected AV unit on or off, Xorg (1.17.4) suddenly crashes.

This has been observed on xf86-video-ati 7.6.1 and 78fbca0. It worked fine under 7.5.0 and I have bisected the problem to 2f11dcd, which added hotplugging for DP 1.2. I don't have any DisplayPort hardware here though, it's all DVI/HDMI.

This is only affecting Zaphod mode. I have tried with no xorg.conf to give me xrandr mode and I was unable to reproduce the problem there.

I have attached Xorg.0.log, which includes a backtrace. I have looked up the addresses in radeon_drv.so and they correspond to the area that was changed. I'm not sure exactly where the first entry is as I don't have a core dump but I may obtain one later.

[172723.305] (EE) 3: /usr/lib64/xorg/modules/drivers/radeon_drv.so (0x7fdbbdd19000+0x4d510) [0x7fdbbdd66510]
http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/tree/src/drmmode_display.c?id=78fbca095ae9887a2d3de48bb07975e2d1126e68#n1567

[172723.305] (EE) 4: /usr/lib64/xorg/modules/drivers/radeon_drv.so (0x7fdbbdd19000+0x502c9) [0x7fdbbdd692c9]
http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/tree/src/drmmode_display.c?id=78fbca095ae9887a2d3de48bb07975e2d1126e68#n2403

[172723.305] (EE) 5: /usr/lib64/xorg/modules/drivers/radeon_drv.so (0x7fdbbdd19000+0x50387) [0x7fdbbdd69387]
http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/tree/src/drmmode_display.c?id=78fbca095ae9887a2d3de48bb07975e2d1126e68#n2426
Comment 1 Michel Dänzer 2015-12-17 02:19:25 UTC
Dave, any ideas offhand?

(In reply to James Le Cuirot from comment #0)
> [172723.305] (EE) 3: /usr/lib64/xorg/modules/drivers/radeon_drv.so
> (0x7fdbbdd19000+0x4d510) [0x7fdbbdd66510]
> http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/tree/src/
> drmmode_display.c?id=78fbca095ae9887a2d3de48bb07975e2d1126e68#n1567

This line doesn't seem to match up with the rest of the backtrace. Please get a backtrace with gdb.
Comment 2 James Le Cuirot 2015-12-17 20:10:10 UTC
Here you go.

#0  0x00007fdde79f7510 in snprintf (__fmt=<optimized out>, __n=<optimized out>, __s=<optimized out>) at /usr/include/bits/stdio2.h:64
#1  drmmode_create_name (koutput=0x24aaa30, koutput=0x24aaa30, num_hdmi=0x0, num_dvi=0x0, path_blob=0x0, name=0x7ffff5023790 "\240!F\002", pScrn=0x1f5bd80) at drmmode_display.c:1475
#2  drmmode_output_init (pScrn=pScrn@entry=0x1f5bd80, drmmode=drmmode@entry=0x1f5cd30, num=0, num_dvi=num_dvi@entry=0x0, num_hdmi=num_hdmi@entry=0x0, dynamic=1, mode_res=0x1f671b0)
    at drmmode_display.c:1538
#3  0x00007fdde79fa2c9 in radeon_mode_hotplug (scrn=0x1f5bd80, drmmode=0x1f5cd30) at drmmode_display.c:2403
#4  0x00007fdde79fa387 in drmmode_handle_uevents (fd=<optimized out>, closure=0x1f5cd30) at drmmode_display.c:2426
#5  0x00000000004767fa in xf86Wakeup ()
#6  0x000000000043cc0b in WakeupHandler ()
#7  0x000000000058876d in WaitForSomething ()
#8  0x0000000000437dd1 in ?? ()
#9  0x000000000043c0bb in ?? ()
#10 0x00007fddec4dc620 in __libc_start_main () from /lib64/libc.so.6
#11 0x0000000000426639 in _start ()
Comment 3 James Le Cuirot 2016-02-21 23:05:04 UTC
Still a problem as of 7bc089ee9740a3ef91f16e36786d8ed64e165acd and Linux 4.5-rc5. I've had to hold back to xorg-server 1.17 because 7.50 won't build against 1.18.
Comment 4 Michal Schmidt 2016-04-08 09:16:27 UTC
radeon_mode_hotplug() calls drmmode_output_init() with num_dvi=NULL, num_hdmi=NULL. drmmode_create_name() dereferences them.
Comment 5 Michel Dänzer 2016-04-13 02:15:43 UTC
Created attachment 122886 [details] [review]
Handle Zaphod mode correctly in  radeon_mode_hotplug

Does this patch fix the problem?
Comment 6 James Le Cuirot 2016-04-17 11:02:26 UTC
(In reply to Michel Dänzer from comment #5)
> Created attachment 122886 [details] [review] [review]
> Handle Zaphod mode correctly in  radeon_mode_hotplug
> 
> Does this patch fix the problem?

That does appear to have fixed it, thanks very much.
Comment 7 Michel Dänzer 2016-05-10 09:52:11 UTC
commit c801f9f10a5d72d935faf21e72f7e7808fb4f05f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Apr 13 11:12:38 2016 +0900

    Handle Zaphod mode correctly in radeon_mode_hotplug

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.