Bug 1417810

Summary: lshw: segfault
Product: [Fedora] Fedora Reporter: Ralf Corsepius <rc040203>
Component: lshwAssignee: Terje Røsten <terje.rosten>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: terje.rosten
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lshw-B.02.18-13.fc27 lshw-B.02.18-13.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-06 15:30:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ralf Corsepius 2017-01-31 06:45:12 UTC
Description of problem:

For me, on one machine, lshw segfaults very hard:
# lshw
Segmentation fault

No further diagnosis, no core dump/stack-dump, just a segfault.

Stracing also doesn't seem to be helpful:
...
write(2, "\rSMP\r", 5)                  = 5
open("/dev/mem", O_RDONLY)              = 3
lseek(3, 1038, SEEK_SET)                = 1038
read(3, "\300\237", 2)                  = 2
lseek(3, 654336, SEEK_SET)              = 654336
read(3, "\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
lseek(3, 1043, SEEK_SET)                = 1043
read(3, "\177\2", 2)                    = 2
lseek(3, 653312, SEEK_SET)              = 653312
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
lseek(3, 654336, SEEK_SET)              = 654336
read(3, "\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
lseek(3, 983040, SEEK_SET)              = 983040
read(3, "\36\6fVfW\234fSf\273\0\0\21@hP\267\232P\372\0\340f[\372\350l&f\277\0"..., 65536) = 65536
lseek(3, 917504, SEEK_SET)              = 917504
read(3, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"..., 65536) = 65536
lseek(3, 524288, SEEK_SET)              = 524288
read(3,  <unfinished ...>)              = ?
+++ killed by SIGSEGV +++


My gut feeling is, smp detection is failing.


Version-Release number of selected component (if applicable):
lshw-B.02.18-5.fc25.i686

How reproducible:
Always.

Steps to Reproduce:
1. try to run lshw as root:
# lshw

Additional info:
* The segfault does happen, when running lsh as non-root.
* The machine exposing this issue is a ca. 15 year old single-core Pentium III. I can not reproduce it on x86_64s and dual core i686ers.

Comment 1 Ralf Corsepius 2017-01-31 07:52:05 UTC
Additional info:

The segfault occurs in readEntry at line 203 in src/core/smp.cc

...
       for (x = 0; x < GROPE_SIZE/4; NEXT(x)) {
                if (!strncmp((char *)&buffer[x], MP_SIG, 4)) {
                        *paddr = (x*4) + GROPE_AREA1;
                        return 5;
                }
        }

        target = GROPE_AREA2;
        seekEntry(target);
>>>     readEntry(buffer, GROPE_SIZE);

        for (x = 0; x < GROPE_SIZE/4; NEXT(x)) {
                if (!strncmp((char *)&buffer[x], MP_SIG, 4)) {
                        *paddr = (x*4) + GROPE_AREA2;
                        return 6;
                }
        }
...

Comment 2 Terje Røsten 2017-01-31 19:04:15 UTC
Thanks for report! 

Pentium III! A pleasure to meet you again :-)

Comment 3 Ralf Corsepius 2017-02-01 05:20:58 UTC
(In reply to Terje Røsten from comment #2)
> Pentium III! A pleasure to meet you again :-)
Yep, even though many folks violently deny this, Fedora works quite well on old machines :-)

# cat /proc/cpuinfo 
...
model name	: Pentium III (Coppermine)
...
cpu MHz		: 1004.939
...
cpu cores	: 1
...

Of course this is not a "production machine" :-)

(In reply to Ralf Corsepius from comment #0)
> * The segfault does happen, when running lsh as non-root.
Ouch, this is an ugly typo. It was meant to read: 
The segfault only happens when running lshw as root. It does not happen as non-root.

> * The machine exposing this issue is a ca. 15 year old single-core Pentium
> III. I can not reproduce it on x86_64s and dual core i686ers.

Meanwhile, I also noticed this issue on an Intel Atom N270-based netbook. 
There, it sporadically seems to happen once, directly after system startup/booting. Subsequent calls to lshw do not segfault. 

[gut feeling/wild guess: lshw is accessing non-initialized memory?]

Comment 4 Fedora End Of Life 2017-11-16 19:44:05 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 5 Fedora Update System 2018-01-27 08:45:41 UTC
lshw-B.02.18-13.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2018-eac662c7c4

Comment 6 Fedora Update System 2018-01-27 08:46:03 UTC
lshw-B.02.18-13.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-8a9587a92f

Comment 7 Fedora Update System 2018-01-28 22:34:48 UTC
lshw-B.02.18-13.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-eac662c7c4

Comment 8 Fedora Update System 2018-01-28 23:04:36 UTC
lshw-B.02.18-13.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-8a9587a92f

Comment 9 Fedora Update System 2018-02-06 15:30:05 UTC
lshw-B.02.18-13.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2018-02-08 09:25:57 UTC
lshw-B.02.18-13.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.