#878792 lshw crashes with SEGV in privileged containers, unless you disable the 'usb' test.

Package:
lshw
Source:
lshw
Description:
information about hardware configuration
Submitter:
Eric Desrochers
Date:
2017-10-17 03:24:02 UTC
Severity:
normal
#878792#5
Date:
2017-10-16 16:16:17 UTC
From:
To:
Dear Maintainer,

lshw crashes with SEGV in privileged containers in Ubuntu, unless you
disable the 'usb' test as follow :

$ lshw -disable usb


Note that the problem isn't reproducible in Debian because the container
image doesn't contains the 2 files from where lshw try to get
informations :

/proc/bus/usb/devices
/sys/kernel/debug/usb/devices

thus stop at the following lshw verification :

if (!exists(SYSKERNELDEBUGUSBDEVICES) && !exists(PROCBUSUSBDEVICES))
  return false


but in Ubuntu, lshw segfault in a privileged container because the
actual lshw code only look if both doesn't exist or one of them is
inaccessible (EACCESS).. then lshw segfault.

For more informations about the Ubuntu bug :
https://bugs.launchpad.net/bugs/1699161

Despite the fact that debian doesn't exhibit the situation, I think it
would be great to consider this lshw PR since Ubuntu or other
distributions relies on Debian for packages (merge, sync, ...) :

https://ezix.org/src/pkg/lshw/pulls/9

The change is trivial, and only introduce a better mechanism to validate
possible scenarios :

if both files doesn't exist
if 1/2 file exists
if files can't be opene (EACCESS)
....

#878792#10
Date:
2017-10-17 03:21:37 UTC
From:
To:
The PR has been approved/merged in the lshw primary devel site (ezix upstream)

https://ezix.org/src/pkg/lshw/commit/7b99d35064230f908551ba65c29264d90f49f246