[apport] xrandr crashed with SIGSEGV in XRRGetScreenInfo()

Bug #104978 reported by Ted
96
Affects Status Importance Assigned to Milestone
xrandr (Ubuntu)
Won't Fix
Medium
Unassigned

Bug Description

Binary package hint: xrandr

A segfault happened when I entered the command xrandr. I see a lot of other reports originating from device manager, but I'd like to bring light to the fact that its not just that. This also won't work in my NVIDIA X config editor or in Cedega.

ProblemType: Crash
Architecture: amd64
CrashCounter: 1
Date: Mon Apr 9 18:01:04 2007
DistroRelease: Ubuntu 7.04
ExecutablePath: /usr/bin/xrandr
Package: xrandr 1:1.0.2-0ubuntu1
PackageArchitecture: amd64
ProcCmdline: xrandr
ProcCwd: /home/teddy
ProcEnviron:
 SHELL=/bin/bash
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
 LANG=en_US.UTF-8
Signal: 11
SourcePackage: xrandr
StacktraceTop:
 ?? () from /usr/lib/libXrandr.so.2
 XRRGetScreenInfo () from /usr/lib/libXrandr.so.2
 ?? ()
 __libc_start_main () from /lib/libc.so.6
 ?? ()
Uname: Linux Ashbringer 2.6.20-14-generic #2 SMP Mon Apr 2 16:32:46 UTC 2007 x86_64 GNU/Linux
UserGroups: adm admin audio cdrom dialout dip floppy lpadmin plugdev scanner video

Revision history for this message
Ted (tedks) wrote :
Revision history for this message
Ted (tedks) wrote :

This was fixed by disabling xinerama in my X config file.

Revision history for this message
xtknight (xt-knight) wrote :
Download full text (4.0 KiB)

I have the same problem. It is because Xinerama+Xrandr don't work together. Xinerama causes Xrandr to malfunction. And when the 'xrandr' program tries to access the Xrandr X extension, it gets a wrong response that it exists but it doesn't.

(Feisty i386 / nvidia)
Pkg: xrandr 1:1.0.2-0ubuntu1
Pkg: libxrandr2 2:1.2.0-3ubuntu1
Pkg: libxext6 2:1.0.3-1build1

I have traced the bug's path. I hope this helps the bug-squatters.

$ ltrace xrandr
__libc_start_main(0x8048d01, 1, 0xbf9c2284, 0x8049df9, 0x8049df4 <unfinished ...>
XOpenDisplay(NULL) = 0x804c008
XRRGetScreenInfo(0x804c008, 421, 0xb7f67ff4, 0xb7f2ce7c, 4 <unfinished ...>

It is crashing within XRRGetScreenInfo(). There is a null pointer causing a segmentation fault.

++Excerpt <main()> from <xrandr-1.0.2/xrandr.c>++
Line 207: sc = XRRGetScreenInfo (dpy, root);
//crashes within XRRGetScreenInfo()

++Excerpt <XRRGetScreenInfo()> from <libxrandr-1.2.0/src/XrrConfig.c>++
-----------------------
Line 345: XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Window window)
{
    XRRScreenConfiguration *config;
    XExtDisplayInfo *info = XRRFindDisplay(dpy); // Xinerama+XRANDR crash: XRRFindDisplay() DOES NOT RETURN COMPLETE STRUCTURE (info->codes missing)
    XRRFindDisplay(dpy);
    LockDisplay (dpy);
    /*SEGFAULT WITHIN>>>>>>>>>>*/ config = _XRRGetScreenInfo(dpy, info /*sending incomplete structure*/, window);
    UnlockDisplay (dpy);
    SyncHandle ();
    return config;
}
-----------------------
++Excerpt <XRRFindDisplay()> from <libxrandr-1.2.0/src/Xrandr.c>++
-----------------------
Line 213: XExtDisplayInfo *
XRRFindDisplay (Display *dpy)
{
    XExtDisplayInfo *dpyinfo;
    XRandRInfo *xrri;
    int i, numscreens;
    dpyinfo = XextFindDisplay (&XRRExtensionInfo, dpy);

    if (!dpyinfo) {
 dpyinfo = XextAddDisplay (&XRRExtensionInfo, dpy,
      XRRExtensionName,
      &rr_extension_hooks,
      RRNumberEvents, 0);
       // dpyinfo->codes = NULL received from XextAddDisplay() <------- problem
       ....
       return dpyinfo; // structure with missing 'codes' member returned to caller <XRRGetScreenInfo()>
-----------------------
++Excerpt <XextAddDisplay()> from <libxext-1.0.3/src/extutil.c>++
-----------------------
Line 94: XExtDisplayInfo *XextAddDisplay (
    XExtensionInfo *extinfo,
    Display *dpy,
    char *ext_name,
    XExtensionHooks *hooks,
    int nevents,
    XPointer data)
{
    XExtDisplayInfo *dpyinfo;
    dpyinfo = (XExtDisplayInfo *) Xmalloc (sizeof (XExtDisplayInfo));
    ....
    dpyinfo->codes = XInitExtension (dpy, ext_name); // in this case, initialize XRandr extension for dpy (display)

    if (dpyinfo->codes) {
    ....
    } else if (hooks->close_display) {
        /*....*/
        XExtCodes *codes = XAddExtension(dpy);
 if (!codes) {
     XFree(dpyinfo);
     return NULL;
 }

        // INFO: but <<< codes >>> is not NULL
        // so it falls through to here
        // dpyinfo is later returned with a blank 'codes' member/pointer.

        XESetCloseDisplay (dpy, codes->extension, hooks->close_display);
    }

    ....
    return dpyinfo; // it is returned here. it then returns to the calling function <...

Read more...

Changed in xrandr:
importance: Undecided → Medium
status: Unconfirmed → Confirmed
Revision history for this message
Apport retracing service (apport) wrote : Symbolic stack trace

StacktraceTop:XRRGetScreenInfo (dpy=0x503010, window=342) at ../../src/XrrConfig.c:351
?? ()
__libc_start_main () from /lib/libc.so.6
?? ()

Revision history for this message
Apport retracing service (apport) wrote : Symbolic threaded stack trace
Revision history for this message
Paul Eggleton (bluelightning) wrote :

I also experienced this bug when I tried to plug a monitor into my laptop and configure it. Unfortunately since the power management applet and System Settings: Monitor & Display settings applications in Kubuntu link to libxrandr, they also crash instantly upon being run which means that you can't fix the problem other than by manually editing xorg.conf.

Revision history for this message
Bryce Harrington (bryce) wrote :

xtknight, are you using the nv driver or the nvidia driver?

Revision history for this message
Bryce Harrington (bryce) wrote :

Unfortunately, Xinerama and Xrandr are fundamentally incompatible, and there are no plans to fix this upstream.

For Ubuntu, going forward our plan is to simply push for all drivers to switch to Xrandr. For those drivers which haven't switched, the xrandr command-line tool will not support them.

Changed in xrandr:
status: Confirmed → Won't Fix
Revision history for this message
wilbur (wilbur-unail) wrote :

guys, how do u disable Xinerama? following is part of my xorg.conf

Section "Extensions"
            Option "Xinerama" "Disable"
            Option "RANDR" "Enable"
EndSection

the /var/log/Xorg.0.log reads that Xinerama is disabled and RANDR is enabled, but x still crash when I xrandr.

any reply will be greatly appreciated.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.