Bug#812604: nut-server: usbhid-ups segfaults due to missing USB strings
FYI I've also made a somewhat complementary patch that tries 3 times to get these string (only once currently elsewhere). Iirc it's still sitting in the libusb1 branch on github, and it's not yet merged in the mainline. Would be cool if you could test... Cheers, Arno
Bug#812604: nut-server: usbhid-ups segfaults due to missing USB strings
I hit the exact same 'segfault' bug. I upgrade to nut version 2.7.4 from testing, where patch in comment #5 is included. My APC Back-UPS RS 900G is now running fine with nut. I would be nice to have the patch included or a backport of this package for the 'Buggy' apc owners on jessie.
Bug#812604: nut-server: usbhid-ups segfaults due to missing USB strings
Also seeing this with a APC Back-UPS Pro and usbhid-ups, but on a physical machine, so no vmware shenenigans to mess with the USB descriptors. lsusb shows the iManufacturer and iProduct: Bus 005 Device 013: ID 051d:0002 American Power Conversion Uninterruptible Power Supply Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize064 idVendor 0x051d American Power Conversion idProduct 0x0002 Uninterruptible Power Supply bcdDevice0.90 iManufacturer 1 American Power Conversion iProduct2 Back-UPS BR 900GI FW:879.L3 .I USB FW:L3 iSerial 3 3B1125X03827 bNumConfigurations 1 But usbhid-ups lists them as unknown before segfaulting: Starting program: /lib/nut/usbhid-ups -a yzzrt-ups -DD [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Network UPS Tools - Generic HID driver 0.38 (2.7.2) USB communication driver 0.32 0.00 debug level is '2' 0.049516 upsdrv_initups... 0.299042 Checking device ... ... 0.347131 Checking device (051D/0002) (005/013) 0.347166 - VendorID: 051d 0.347201 - ProductID: 0002 0.347215 - Manufacturer: unknown 0.347230 - Product: unknown 0.347256 - Serial Number: unknown 0.347272 - Bus: 005 0.347286 Trying to match device Program received signal SIGSEGV, Segmentation fault. __strncmp_ssse3 () at ../sysdeps/x86_64/multiarch/../strcmp.S:1233 1233../sysdeps/x86_64/multiarch/../strcmp.S: No such file or directory. Confirm that patching nut-2.7.2 with the patch in #5 fixes this: 0.299235 Checking device (051D/0002) (005/013) 0.299268 - VendorID: 051d 0.299287 - ProductID: 0002 0.299301 - Manufacturer: unknown 0.299316 - Product: unknown 0.299330 - Serial Number: unknown 0.299344 - Bus: 005 0.299359 Trying to match device 0.299373 device->Product is NULL so it is not possible to determine whether to activate max_report_size workaround 0.299390 Device matches Although it seems that this is slightly random; trying again a second time it actually sees the idProduct this time: 0.298864 Checking device (051D/0002) (005/013) 0.310794 - VendorID: 051d 0.310804 - ProductID: 0002 0.310808 - Manufacturer: American Power Conversion 0.310811 - Product: Back-UPS BR 900GI FW:879.L3 .I USB FW:L3 0.310815 - Serial Number: 3B1125X03827 0.310819 - Bus: 005 0.310822 Trying to match device 0.310835 Device matches No idea. -- Tero Marttila
Bug#812604: nut-server: usbhid-ups segfaults due to missing USB strings
Package: nut-server Version: 2.7.2-4 Severity: important Tags: upstream patch Dear Maintainer, I am using an APC Back-UPS Pro with the usbhid-ups driver in NUT. After upgrading from Debian 6 to Debian 8, the driver would not start anymore and segfaulted before delivering any data. There is an upstream bug report at https://github.com/networkupstools/nut/issues/258 that deals with this problem. It is due to incorrect handling of a missing USB product identifier string. Apparently the issue only occurs when running on VMware ESXi, where the USB string is probably lost due to some issue with the hypervisor, the kernel, or libusb. A patch is available upstream at https://github.com/networkupstools/nut/commit/f679a28 and I have confirmed that it fixes the bug for version 2.7.2 in Debian too. Thanks, Michael Kuron -- System Information: Debian Release: 8.3 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 3.16.0-4-686-pae (SMP w/1 CPU core) Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages nut-server depends on: ii adduser 3.113+nmu3 ii init-system-helpers 1.22 ii libc62.19-18+deb8u2 ii libnspr4 2:4.10.7-1+deb8u1 ii libnss3 2:3.17.2-1.1+deb8u2 ii libupsclient42.7.2-4 ii libusb-0.1-4 2:0.1.12-25 ii libwrap0 7.6.q-25 ii lsb-base 4.1+Debian13+nmu1 ii nut-client 2.7.2-4 ii udev 215-17+deb8u3 nut-server recommends no packages. Versions of packages nut-server suggests: pn nut-cgi pn nut-ipmi pn nut-snmp pn nut-xml -- Configuration Files: /etc/nut/ups.conf [Errno 13] Permission denied: u'/etc/nut/ups.conf' /etc/nut/upsd.conf [Errno 13] Permission denied: u'/etc/nut/upsd.conf' /etc/nut/upsd.users [Errno 13] Permission denied: u'/etc/nut/upsd.users' -- no debconf information diff --git a/drivers/apc-hid.c b/drivers/apc-hid.c index 1d85621..1393d50 100644 --- a/drivers/apc-hid.c +++ b/drivers/apc-hid.c @@ -62,6 +62,11 @@ static void *general_apc_check(USBDevice_t *device) { int i = 0; + if (!device->Product) { + upslogx(LOG_WARNING, "device->Product is NULL so it is not possible to determine whether to activate max_report_size workaround"); + return NULL; + } + /* Some models of Back-UPS overflow on some ReportID. * This results in some data not being exposed and IO errors on * WIN32, causing endless reconnection or driver's failure */