Bug 21430

Summary: rhd_conntest Segmentation fault
Product: xorg Reporter: Nicolas DEFFAYET <nicolas>
Component: Driver/radeonhdAssignee: Luc Verhaegen <lverhaegen>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
mmap() returns -1 on error, not NULL :) none

Description Nicolas DEFFAYET 2009-04-27 07:43:39 UTC
Hello,

rhd_conntest Segmentation fault when query ATI Technologies Inc Mobility Radeon HD 3470:

# gdb /usr/bin/rhd_conntest
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) set args 1:0:0
(gdb) run
Starting program: /usr/bin/rhd_conntest 1:0:0
rhd_conntest: v1.2.5, dist of git branch master, commit cb54f48b
Checking connectors on 0x95C0, 0x1028, 0x3243  (@01:00:00):

Program received signal SIGSEGV, Segmentation fault.
0x08049211 in RV620DACLoadDetect (map=0xffffffff, tv=0, dac=0) at ../../../utils/conntest/rhd_conntest.c:571
571         CARD32 ret = *(volatile CARD32 *)((CARD8 *) map + offset);
(gdb) bt
#0  0x08049211 in RV620DACLoadDetect (map=0xffffffff, tv=0, dac=0) at ../../../utils/conntest/rhd_conntest.c:571
#1  0x0804bd95 in main (argc=Cannot access memory at address 0xffffff00
) at ../../../utils/conntest/rhd_conntest.c:941
(gdb) quit
The program is running.  Exit anyway? (y or n) y

# gdb /usr/bin/rhd_conntest
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) set args 1:0:0 -d
(gdb) run
Starting program: /usr/bin/rhd_conntest 1:0:0 -d
rhd_conntest: v1.2.5, dist of git branch master, commit cb54f48b
Checking connectors on 0x95C0, 0x1028, 0x3243  (@01:00:00):

Program received signal SIGSEGV, Segmentation fault.
0x08049211 in RV620DACLoadDetect (map=0xffffffff, tv=0, dac=0) at ../../../utils/conntest/rhd_conntest.c:571
571         CARD32 ret = *(volatile CARD32 *)((CARD8 *) map + offset);
(gdb) bt
#0  0x08049211 in RV620DACLoadDetect (map=0xffffffff, tv=0, dac=0) at ../../../utils/conntest/rhd_conntest.c:571
#1  0x0804bd95 in main (argc=Cannot access memory at address 0xffffff00
) at ../../../utils/conntest/rhd_conntest.c:941
(gdb) quit
The program is running.  Exit anyway? (y or n) y
#

Any idea why ?

95C0.1028.3243.vga.rom is generated before rhd_conntest Segmentation fault.

Thank you

Best Regards,

Nicolas DEFFAYET
Comment 1 Jakub Zawadzki 2009-04-27 08:17:04 UTC
Created attachment 25189 [details] [review]
mmap() returns -1 on error, not NULL :)

After applying this patch, rhd_conntest should print error instead of segv.
Comment 2 Matthias Hopf 2009-04-29 09:58:44 UTC
Very true...

Committed.

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.