It does segfault on Xenial, but it is also reproducible using Zesty privileged container.
In fact, it is a behavior not yet reported nor fix upstream. I can confirm it by having tested the reproducer against the latest and greatest compiled by hand lshw binary using Xenial privileged container.
It tries to open '/sys/kernel/debug/usb/devices' that exist but doesn't have permission to be fopen and then try '/proc/bus/usb/devices' which doesn't exist. I agree with Rafael that there must be a better mechanism to be protected against this situation.
--
root@priv:/tmp/lshw# ls -altr /proc/bus/usb/devices
ls: cannot access '/proc/bus/usb/devices': No such file or directory
root@priv:/tmp/lshw# ls -altr /sys/kernel/debug/usb/devices
-r--r--r-- 1 root root 0 Oct 11 11:19 /sys/kernel/debug/usb/devices
So this look like it'll need to be fix upstream first.
I'll start to look at it.
I tried to create a new ticket with ezIX without success, their tracker is giving me errors.
I have emailed Lyonel Vincent, so he can hopefully file the bug on our behalf.
Update:
I've been asked to look at this problem
It does segfault on Xenial, but it is also reproducible using Zesty privileged container.
In fact, it is a behavior not yet reported nor fix upstream. I can confirm it by having tested the reproducer against the latest and greatest compiled by hand lshw binary using Xenial privileged container.
It tries to open '/sys/kernel/ debug/usb/ devices' that exist but doesn't have permission to be fopen and then try '/proc/ bus/usb/ devices' which doesn't exist. I agree with Rafael that there must be a better mechanism to be protected against this situation.
-- /tmp/lshw# ls -altr /proc/bus/ usb/devices bus/usb/ devices' : No such file or directory
root@priv:
ls: cannot access '/proc/
root@priv: /tmp/lshw# ls -altr /sys/kernel/ debug/usb/ devices debug/usb/ devices
-r--r--r-- 1 root root 0 Oct 11 11:19 /sys/kernel/
root@priv: /tmp/lshw# cat /sys/kernel/ debug/usb/ devices debug/usb/ devices: Permission denied
cat: /sys/kernel/
---
So this look like it'll need to be fix upstream first.
I'll start to look at it.
I tried to create a new ticket with ezIX without success, their tracker is giving me errors.
I have emailed Lyonel Vincent, so he can hopefully file the bug on our behalf.
- Eric