diff -u lshw-02.17/debian/changelog lshw-02.17/debian/changelog --- lshw-02.17/debian/changelog +++ lshw-02.17/debian/changelog @@ -1,3 +1,11 @@ +lshw (02.17-1.1ubuntu3.4) xenial; urgency=medium + + * d/p/fix-segfault-in-privileged-containers.patch: + Fix lshw crashes with SEGV in privileged containers (LP: #1699161) + (cherry-picked from EZix upstream commit [7b99d35]) + + -- Eric Desrochers Mon, 30 Oct 2017 07:39:31 -0400 + lshw (02.17-1.1ubuntu3.3) xenial; urgency=medium * Fix situation where lshw segfaults, when there is an external diff -u lshw-02.17/debian/patches/series lshw-02.17/debian/patches/series --- lshw-02.17/debian/patches/series +++ lshw-02.17/debian/patches/series @@ -21,0 +22 @@ +fix-segfault-in-privileged-containers.patch only in patch2: unchanged: --- lshw-02.17.orig/debian/patches/fix-segfault-in-privileged-containers.patch +++ lshw-02.17/debian/patches/fix-segfault-in-privileged-containers.patch @@ -0,0 +1,36 @@ +Description: Fix lshw crashes with SEGV in privileged containers. + lshw cmd is segfaulting when ran inside a privileged container because + in a privileged container all debugfs access are denied (as it should be). + This patch offer a better mechanism to detect if SYSKERNELDEBUGUSBDEVICES + or PROCBUSUSBDEVICES exist and if it can be properly open. + + # lshw strace inside privileged container with a Ubuntu img. + ... + open("/sys/kernel/debug/usb/devices", O_RDONLY) = -1 EACCES (Permission denied) + open("/proc/bus/usb/devices", O_RDONLY) = -1 ENOENT (No such file or directory) + +Author: Eric Desrochers +Origin: upstream, https://ezix.org/src/pkg/lshw/commit/7b99d35064230f908551ba65c29264d90f49f246 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1699161 +Index: lshw-02.17/src/core/usb.cc +=================================================================== +--- lshw-02.17.orig/src/core/usb.cc ++++ lshw-02.17/src/core/usb.cc +@@ -376,10 +376,15 @@ bool scan_usb(hwNode & n) + } + filenames.clear(); + +- usbdevices = fopen(SYSKERNELDEBUGUSBDEVICES, "r"); +- if(!usbdevices) ++ if (exists(SYSKERNELDEBUGUSBDEVICES)) ++ usbdevices = fopen(SYSKERNELDEBUGUSBDEVICES, "r"); ++ ++ if(!usbdevices && exists(PROCBUSUSBDEVICES)) + usbdevices = fopen(PROCBUSUSBDEVICES, "r"); + ++ if(!usbdevices) ++ return false; ++ + while(!feof(usbdevices)) + { + char * buffer = NULL;