Bug 487516 - lspci segfaults when pci.ids cannot be found
Summary: lspci segfaults when pci.ids cannot be found
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: pciutils
Version: 10
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Michal Hlavinka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-02-26 14:13 UTC by Milos Malik
Modified: 2010-04-21 12:47 UTC (History)
2 users (show)

Fixed In Version: 2.2.10-4.fc9
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-02-28 03:26:08 UTC
Type: ---


Attachments (Terms of Use)
strace -o lspci.trace /sbin/lspci (40.78 KB, application/octet-stream)
2009-03-16 16:31 UTC, Sertaç Ö. Yıldız
no flags Details
core dump from lspci (1.03 MB, application/octet-stream)
2009-03-17 07:40 UTC, Sertaç Ö. Yıldız
no flags Details

Description Milos Malik 2009-02-26 14:13:43 UTC
Description of problem:
The lspci utility ends with segmentation fault when pci.ids file cannot be found.

Version-Release number of selected component (if applicable):
pciutils-3.0.2-1.fc10

How reproducible:
always

Steps to Reproduce:
# mv /usr/share/hwdata/pci.ids /usr/share/hwdata/pci.ids.orig
# lspci
Segmentation fault (core dumped)
# echo $?
139
  
Actual results:
segmentation fault

Expected results:
display an error message that pci.ids file was not found

Additional info:

Comment 1 Michal Hlavinka 2009-02-26 16:01:44 UTC
I can confirm this. Problem is located in patch-dir-d.patch

Comment 2 Milos Malik 2009-02-26 16:28:57 UTC
If /usr/share/hwdata/pci.ids is not readable for others and if lspci is executed by a common user then lspci segfaults too.

Another reproducer:

$ su -
Password:
# chmod o= /usr/share/hwdata/pci.ids
# exit
$ lspci
Segmentation fault (core dumped)
$ echo $?
139

Comment 3 Fedora Update System 2009-02-26 16:43:13 UTC
pciutils-3.0.2-3.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/pciutils-3.0.2-3.fc10

Comment 4 Fedora Update System 2009-02-27 19:33:12 UTC
pciutils-2.2.10-4.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/pciutils-2.2.10-4.fc9

Comment 5 Fedora Update System 2009-02-28 03:26:04 UTC
pciutils-3.0.2-3.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 6 Fedora Update System 2009-02-28 03:29:20 UTC
pciutils-2.2.10-4.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Sertaç Ö. Yıldız 2009-03-15 02:45:30 UTC
With pciutils-3.0.2-3.fc10.i386 from koji, still something is wrong.

Related lines from strace output:

open("/usr/share/hwdata/pci.ids.d/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/dev/tty", O_RDWR|O_NOCTTY|O_NONBLOCK) = 4
writev(4, [{"*** "..., 4}, {"stack smashing detected"..., 23}, {" ***: "..., 6}, {"/sbin/lspci"..., 11}, {" terminated\n"..., 12}], 5) = 56

Comment 8 Michal Hlavinka 2009-03-16 15:22:39 UTC
I've tried executing strace lspci and found nothing interesting. Also I've trying to trace what's going on and again nothing interesting...

Could you attach complete strace output? 
32/64bit?
Have you made any modifications to pciutils / pci.ids databaze?
Do you have debuginfo installed?
What command (exactly) produced that strace?

Thanks

Comment 9 Sertaç Ö. Yıldız 2009-03-16 16:31:01 UTC
Created attachment 335371 [details]
strace -o lspci.trace /sbin/lspci

This is what I get:

$ /sbin/lspci
*** stack smashing detected ***: /sbin/lspci terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x48)[0x666c18]
/lib/libc.so.6(__fortify_fail+0x0)[0x666bd0]
/usr/lib/libpci.so.3[0x6e9dc4]
/usr/lib/libpci.so.3[0x6e7265]
/usr/lib/libpci.so.3(pci_load_name_list+0xa3)[0x6e7323]
/usr/lib/libpci.so.3(pci_lookup_name+0x61e)[0x6e5eee]
/sbin/lspci[0x804ca1a]
/sbin/lspci[0x8051318]
/sbin/lspci[0x8051b18]
/lib/libc.so.6(__libc_start_main+0xe6)[0x5867d6]
/sbin/lspci[0x8048ee1]
======= Memory map: ========
...

$ rpm -V hwdata pciutils{,-{libs,devel}}
(no output)
$ rpm -q hwdata pciutils{,-{libs,devel}}
hwdata-0.222-1.fc10.noarch
pciutils-3.0.2-3.fc10.i386
pciutils-libs-3.0.2-3.fc10.i386
pciutils-devel-3.0.2-3.fc10.i386

This is on an i386 (Intel Core Duo) laptop. I don't have debuginfo packages installed, but let me know if you need.

Comment 10 Michal Hlavinka 2009-03-17 06:55:15 UTC
(In reply to comment #9)
> ...
> This is on an i386 (Intel Core Duo) laptop. I don't have debuginfo packages
> installed, but let me know if you need.  

yes, please re-do with pciutils-debuginfo installed
( debuginfo-install pciutils )

then enable core dumps and run lspci (you need it to run this in writable directory) : 

ulimit -c 999999
lspci

it should create file core.<number> in that directory. Please attach it.


Also output of 

ls -lR /usr/share/hwdata/

will be useful.


btw, have you made any modifications to pciutils / pci.ids databaze?

thanks

Comment 11 Sertaç Ö. Yıldız 2009-03-17 07:40:09 UTC
Created attachment 335486 [details]
core dump from lspci

(In reply to comment #10)
> yes, please re-do with pciutils-debuginfo installed
> ( debuginfo-install pciutils )

That command did not work for latest pciutils packages. I manually installed just the pciutils-debuginfo rpm. I suppose that's the only one needed.

> ls -lR /usr/share/hwdata/

/usr/share/hwdata/:
total 3204
-rw-r--r-- 1 root root  346759 Oca 28 11:58 MonitorsDB
-rw-r--r-- 1 root root 1948830 Oca 28 11:58 oui.txt
-rw-r--r-- 1 root root  586319 Oca 28 11:58 pci.ids
-rw-r--r-- 1 root root    1622 Oca 28 11:58 upgradelist
-rw-r--r-- 1 root root  358992 Oca 28 11:58 usb.ids
drwxr-xr-x 2 root root    4096 Oca 28 11:58 videoaliases
-rw-r--r-- 1 root root    2145 Oca 28 11:58 videodrivers

/usr/share/hwdata/videoaliases:
total 28
-rw-r--r-- 1 root root 1747 Ara  2 07:46 i810.xinf
-rw-r--r-- 1 root root 1234 Ağu 17  2006 sis.xinf
-rw-r--r-- 1 root root 1277 Tem 13  2006 via.xinf
-rw-r--r-- 1 root root  110 Mar 20  2008 vmware.xinf

> btw, have you made any modifications to pciutils / pci.ids databaze?

There were already some rpmsave files there, but I'd removed them before updating from koji. AFAIK 'rpm -V' output should display any modifications, so I assume the files are from hwdata rpm.

Comment 12 Sertaç Ö. Yıldız 2009-03-17 08:07:16 UTC
Actually the problem seems to be in libc. After reinstalling glibc rpms when installing glibc-debuginfo, lspci began to work fine.

Sorry for taking your time.

Comment 13 Michal Hlavinka 2009-03-17 09:21:38 UTC
(In reply to comment #12)
> Actually the problem seems to be in libc. After reinstalling glibc rpms when
> installing glibc-debuginfo, lspci began to work fine.
> 
> Sorry for taking your time.  

No problem. Thanks for testing.


Note You need to log in before you can comment on or make changes to this bug.