Bug#284111: xserver-xfree86: Doesn't scan PCI domains above 0000 on startup

2005-01-13 Thread Bjorn Helgaas
On Thu, 2005-01-13 at 17:59 -0500, Branden Robinson wrote:
 On Fri, Dec 31, 2004 at 12:18:29AM -0800, David Mosberger wrote:
Branden I wonder how many domains we should look for before we give
Branden up.  I get the feeling doing an ftw() on /proc/pci/pci is
Branden not a good idea.  Even doing as much as a readdir() feels
Branden wrong, but maybe not.  :-P

I think readdir() should be kosher.  ls in /proc/bus/pci
has to get its data somehow.

But I'm confused about why we would iterate through all
the domains anyway, since we don't seem to iterate through
all PCI buses.  Maybe X's PCITAG doesn't include a domain,
or maybe there's no config file syntax for specifying it?

  I'm not terribly familiar with multi-domain machines.  From what I
  recall, the domain-changes to /proc/bus/pci were SPARC-specific and
  I'm not sure whether that approach is the final answer.

The domain changes to /proc/bus/pci are implemented for
sparc64, ppc64, ia64, alpha, and mips (see pci_name_bus()).
They aren't all identical (sparc64 uses %04x:%02x always,
while ia64 uses %04x:%02x only for non-zero domain), but
they look close enough that one could try %02x first, then
%04x:%02x.

I added Matthew Wilcox in case he has additional input.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#284025: xserver-xfree86: SEGV in RADEONQueryConnectedDisplays

2004-12-02 Thread Bjorn Helgaas
Package: xserver-xfree86
Version: 4.3.0.1.dfsg.1-8
Severity: normal


Script started on Thu 02 Dec 2004 04:40:39 PM MST
[EMAIL PROTECTED]:~# gdb /usr/X11R6/bin/XFree86-debug 
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as ia64-linux...Using host libthread_db library 
/lib/tls/libthread_db.so.1.

(gdb) run
Starting program: /usr/X11R6/bin/XFree86-debug 

This is a pre-release version of XFree86, and is not supported in any
way.  Bugs may be reported to XFree86@XFree86.Org and patches submitted
to [EMAIL PROTECTED]  Before reporting bugs in pre-release versions,
please check the latest version in the XFree86 CVS repository
(http://www.XFree86.Org/cvs).

XFree86 Version 4.3.0.1 (Debian (static) 4.3.0.dfsg.1-8 20040928150828 [EMAIL 
PROTECTED])
Release Date: 15 August 2003
X Protocol Version 11, Revision 0, Release 6.6
Build Operating System: Linux 2.4.25-dsa-mckinley-smp ia64 [ELF] 
Build Date: 28 September 2004
Before reporting problems, check http://www.XFree86.Org/
to make sure that you have the latest version.
OS Kernel: Linux version 2.6.10-rc2 ([EMAIL PROTECTED]) (gcc version 3.3.3 
20040110 (prerelease) (Debian)) #4 SMP Mon Nov 29 16:45:09 MST 2004 
Markers: (--) probed, (**) from config file, (==) default setting,
 (++) from command line, (!!) notice, (II) informational,
 (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: /var/log/XFree86.0.log, Time: Thu Dec  2 16:40:56 2004
(==) Using config file: /etc/X11/XF86Config-4

Program received signal SIGSEGV, Segmentation fault.
RADEONQueryConnectedDisplays (pScrn=0x6010a430, 
pInt10=0x6010d3c0) at radeon_driver.c:1275
1275radeon_driver.c: No such file or directory.
in radeon_driver.c
(gdb) x/i $pc
0x40834f21 RADEONQueryConnectedDisplays+4161: 
ld8 r14=[r14]
(gdb) p $r14
$1 = 568
(gdb) bt
#0  RADEONQueryConnectedDisplays (pScrn=0x6010a430, 
pInt10=0x6010d3c0) at radeon_driver.c:1275
#1  0x408368b0 in RADEONGetBIOSParameters (pScrn=0x6010a430, 
pInt10=0x6010d3c0) at radeon_driver.c:1456
#2  0x4084dcf0 in RADEONPreInit (pScrn=0x6010a430, flags=0)
at radeon_driver.c:4049
#3  0x40de3780 in InitOutput (pScreenInfo=0x600e93e0, argc=1, 
argv=0x6fffb958) at xf86Init.c:574
#4  0x410d2080 in main (argc=1, argv=0x6fffb958, 
envp=0x6fffb968) at main.c:361
(gdb) quit
The program is running.  Exit anyway? (y or n) y
[EMAIL PROTECTED]:~# 
Script done on Thu 02 Dec 2004 04:41:33 PM MST


The problem is pretty clear from the source.  We call vbeDoEDID(),
which usually returns a pointer, but can return NULL for failure.
Then we dereference it without bothering to check for NULL:

for (i = 0; i  5; i++) {
pRADEONEnt-MonInfo1 = vbeDoEDID(pVbe, NULL);
}
if (pRADEONEnt-MonInfo1-rawData[0x14]  0x80)
pRADEONEnt-MonType1 = MT_DFP;
else pRADEONEnt-MonType1 = MT_CRT;

Here's a patch:

--- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c.orig 
2004-11-30 13:59:17.314008332 -0700
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c  2004-11-30 
14:00:14.328656071 -0700
@@ -1272,7 +1272,7 @@
for (i = 0; i  5; i++) {
pRADEONEnt-MonInfo1 = vbeDoEDID(pVbe, NULL);
}
-   if (pRADEONEnt-MonInfo1-rawData[0x14]  0x80)
+   if (pRADEONEnt-MonInfo1  
pRADEONEnt-MonInfo1-rawData[0x14]  0x80)
pRADEONEnt-MonType1 = MT_DFP;
else pRADEONEnt-MonType1 = MT_CRT;
}