Bug 18086 - seg fault when initializing DMX screens
Summary: seg fault when initializing DMX screens
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/DDX/dmx (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: dmx-bugs
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-15 21:10 UTC by Lee Leahu
Modified: 2009-08-03 20:24 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
initialize dmxGCPrivateKey correctly (619 bytes, patch)
2008-10-23 19:15 UTC, Lee Leahu
no flags Details | Splinter Review

Description Lee Leahu 2008-10-15 21:10:32 UTC
Git Commit:  84ef8ed6fbefd8d6c0aaa3c862879f9804299bd8

Segmentation Fault in DMX

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb78106c0 (LWP 20891)]
0x081a6391 in dixRequestPrivate (key=0x820f74c, size=16) at privates.c:93
93          if (size > item->size)

(gdb) bt
#0  0x081a6391 in dixRequestPrivate (key=0x820f74c, size=16) at privates.c:93
#1  0x0807b79b in dmxInitGC (pScreen=0x82406f0) at dmxgc.c:88
#2  0x0808590e in dmxScreenInit (idx=0, pScreen=0x82406f0, argc=7, argv=0xbfc12994) at dmxscrinit.c:231
#3  0x081a60b5 in AddScreen (pfnInit=0x8085877 <dmxScreenInit>, argc=7, argv=0xbfc12994) at main.c:690
#4  0x08080498 in InitOutput (pScreenInfo=0x8226f80, argc=7, argv=0xbfc12994) at dmxinit.c:779
#5  0x081a53ef in main (argc=7, argv=0xbfc12994, envp=0xbfc129b4) at main.c:310

(gdb) list
88      dixRequestPrivate(const DevPrivateKey key, unsigned size)
89      {
90          PrivateDescRec *item = findItem(key);
91          if (!item)
92              return FALSE;
93          if (size > item->size)
94              item->size = size;
95          return TRUE;
96      }
97      

(gdb) print item
$1 = (PrivateDescRec *) 0x8a315ca0

(gdb) print *item
Cannot access memory at address 0x8a315ca0

(gdb) print size
$2 = 16

(gdb) print key
$3 = (const DevPrivateKey) 0x820f74c

(gdb) print *key
$4 = 136378188
Comment 1 Lee Leahu 2008-10-15 21:13:35 UTC
Gentoo Linux

Linux 2.6.27 x86 / 32bit
GCC 4.3.2
GLIBC 2.8

Xnest :0
Xnest :1
Xdmx :2 -br -ac -configfile ./xdmx-config +xinerama 


The contents of the 'xdmx-config' file:
-----------------------------------------------------
virtual screen0 2560x1024 {
    display :0 1280x1024 @0x0;
    display :1 1280x1024 @1280x0;
}
-----------------------------------------------------
Comment 2 Lee Leahu 2008-10-16 23:42:11 UTC
I noticed this error today when compiling xorg-server:

dmxscrinit.c:71: warning: initialization from incompatible pointer type
dmxscrinit.c:70: warning: 'dmxGCPrivateKeyIndex' defined but not used

Comment 3 Lee Leahu 2008-10-23 19:15:37 UTC
Created attachment 19837 [details] [review]
initialize dmxGCPrivateKey correctly

Patch against the latest git commit.

dmxGCPrivateKey is not initialized correctly as a global variable at compile time.
This patch correctly initializes it using dmxGCPrivateKeyIndex.
Comment 4 Lee Leahu 2009-01-07 20:12:38 UTC
Confirming still broken in latest GIT ... 
  736075094346966402213f891628424ccb77bfeb  (2009-01-07 22:12 CST)
Comment 5 Lee Leahu 2009-02-13 04:02:24 UTC
Still broken in GIT as of commit
   a38ca0063c91ef221f20bf0c4ac0dc84ce07d557
Comment 6 Alan Coopersmith 2009-08-03 20:24:53 UTC
Pushed to git master for upcoming Xorg 1.7 release - thanks for the fix:

 hw/dmx/dmxscrinit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b159a98f7fbdb3f8b337cd1bfd2ff27312856619
Author: Lee Leahu <freedesktop-bugs@dyweni.com>
Date:   Thu Oct 23 21:03:57 2008 -0500

    seg fault when initializing DMX screens
    
    X.Org Bugzilla #18086: http://bugs.freedesktop.org/show_bug.cgi?id=18086
    Patch #19837: http://bugs.freedesktop.org/attachment.cgi?id=19837

diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index 7360750..b5afb58 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -68,7 +68,7 @@ static unsigned long dmxGeneration;
 static unsigned long *dmxCursorGeneration;
 
 static int dmxGCPrivateKeyIndex;
-DevPrivateKey dmxGCPrivateKey = &dmxGCPrivateKey; /**< Private index for GCs       */
+DevPrivateKey dmxGCPrivateKey = &dmxGCPrivateKeyIndex; /**< Private index for GCs       */
 static int dmxWinPrivateKeyIndex;
 DevPrivateKey dmxWinPrivateKey = &dmxWinPrivateKeyIndex; /**< Private index for Windows   */
 static int dmxPixPrivateKeyIndex;


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.