lshw crashes with SEGV in privileged containers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lshw (Debian) |
New
|
Unknown
|
|||
lshw (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Eric Desrochers | ||
Zesty |
Fix Released
|
Medium
|
Eric Desrochers | ||
Artful |
Fix Released
|
Medium
|
Eric Desrochers | ||
Bionic |
Fix Released
|
Medium
|
Unassigned |
Bug Description
[Impact]
* lshw crashes with SEGV in privileged containers, unless you disable the 'usb' test: $ lshw -disable usb
[Test Case]
## Create a privileged container. ##
$ lxc launch ubuntu:16.04 priv -c security.
Creating priv
Starting priv
## Execute lshw inside the privileged container. ##
$ lxc exec priv bash
root@priv:~#
root@priv:~#lshw
Segmentation fault
[Regression Potential]
* Risks of regression are low.
* I have tested lshw inside containers (unprivileges/
* Basically, the code look if both files doesn't exists
#define PROCBUSUSBDEVICES "/proc/
#define SYSKERNELDEBUGU
...
if (!exists(
__return false;
I kept the above in place.
But what if only 1 of the 2 files exists ?
For that reason I added an extra verification if SYSKERNELDEBUGU
and
if fopen SYSKERNELDEBUGU
The code first look for SYSKERNELDEBUGU
But if PROCBUSUSBDEVICES fails there was no mechanism to skip, thus segfault.
I also added another if statement in case PROCBUSUSBDEVICES fails like in this situation (no such file or directory) in privileged container, same as if SYSKERNELDEBUGU
[Other Info]
* PR :
https:/
* Upstream Commit:
https:/
* This bug doesn't affect Trusty in privileged container. (The code is a bit different in Trusty/lshw package. It basically doesn't rely on SYSKERNELDEBUGU
* Only affect Xenial and late.
* The bug has been introduced upstream after this specific commit :
https:/
* This particular bug isn't reproducible in Debian (tested with sid in privileged mode) container image because both files doesn't exist in their image, thus making the lshw stop here :
if (!exists(
return false;
With that being said, I filed a debian bug anyway mentioning that it would be great for them to merge the upstream PR since Ubuntu is merging/syncing from them, and it won't hurt debian lshw package, if they change or not their image behavior one day. Even if not necessary fixing an actual debian/lshw bug.
https:/
** Discussion with apw on #ubuntu-release **
[10:45:45] <apw> slashd, artful is open for SRUs, when BB opens it will start from whatever is in A
[11:13:49] <apw> -propsoed gets copied to bb-proposed too yes
[Original Description]
When running lshw in a Xenial container, I'm getting a segmentation fault. I'll attach the apport crash dump.
```
stgraber@
Creating priv
Starting priv
stgraber@
root@priv:~# lshw
Segmentation fault
root@priv:~#
```
[strace of lshw]
open("/
open("/
open("/
open("/
open("/
open("/
open("/
open("/
--- SIGSEGV {si_signo=SIGSEGV, si_code=
+++ killed by SIGSEGV +++
Segmentation fault
Changed in lxd (Ubuntu): | |
assignee: | nobody → Rafael David Tinoco (inaddy) |
status: | New → Confirmed |
Changed in lshw (Ubuntu): | |
importance: | Undecided → Medium |
tags: | added: foundations-engine |
Changed in lshw (Ubuntu Artful): | |
assignee: | Rafael David Tinoco (inaddy) → Eric Desrochers (slashd) |
Changed in lshw (Ubuntu Artful): | |
status: | Confirmed → In Progress |
Changed in lshw (Ubuntu Xenial): | |
assignee: | nobody → Dan Streetman (ddstreet) |
Changed in lshw (Ubuntu Zesty): | |
assignee: | nobody → Dan Streetman (ddstreet) |
importance: | Undecided → Medium |
Changed in lshw (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in lshw (Ubuntu Trusty): | |
importance: | Undecided → Medium |
assignee: | nobody → Dan Streetman (ddstreet) |
status: | New → Confirmed |
description: | updated |
no longer affects: | lshw (Ubuntu Trusty) |
description: | updated |
description: | updated |
Changed in lshw (Ubuntu Artful): | |
assignee: | Eric Desrochers (slashd) → Dan Streetman (ddstreet) |
status: | In Progress → Confirmed |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
tags: | added: sts-sru-needed |
description: | updated |
Changed in lshw (Debian): | |
status: | Unknown → New |
description: | updated |
Changed in lshw (Ubuntu Artful): | |
status: | Confirmed → In Progress |
assignee: | Dan Streetman (ddstreet) → Eric Desrochers (slashd) |
description: | updated |
tags: | added: patch |
Changed in lshw (Ubuntu Xenial): | |
assignee: | Dan Streetman (ddstreet) → Eric Desrochers (slashd) |
Changed in lshw (Ubuntu Xenial): | |
status: | Confirmed → In Progress |
tags: |
added: sts-sru-done removed: sts-sru-needed |
However, lshw -disable USB does work fine.