X-Server segmentation fault during boot if USB HID device is disconnected
Dear Xorg team,
I discovered the following X-Server crash during the boot process in an automated test setup. It is triggered by the disconnection of a USB HID device:
2019-Sep-12 10:11:18.055217 (EE)
2019-Sep-12 10:11:18.055217 (EE) Backtrace:
2019-Sep-12 10:11:18.061812 (EE) 0: /usr/bin/Xorg (OsSigHandler+0x29) [0x16647ab27a9]
2019-Sep-12 10:11:18.063600 (EE) 1: /lib/libc.so.6 (killpg+0x40) [0x7b18b316704f]
2019-Sep-12 10:11:18.063712 (EE) 2: /usr/bin/Xorg (device_added+0x93) [0x166479bebf3]
2019-Sep-12 10:11:18.063804 (EE) 3: /usr/bin/Xorg (config_udev_init+0xc3) [0x166479bf753]
2019-Sep-12 10:11:18.063875 (EE) 4: /usr/bin/Xorg (config_init+0x9) [0x166479be789]
2019-Sep-12 10:11:18.063965 (EE) 5: /usr/bin/Xorg (InitInput+0xb7) [0x166479a27a7]
2019-Sep-12 10:11:18.064088 (EE) 6: /usr/bin/Xorg (dix_main+0x391) [0x16647963cd1]
2019-Sep-12 10:11:18.064214 (EE) 7: /lib/libc.so.6 (__libc_start_main+0xf1) [0x7b18b31542b1]
2019-Sep-12 10:11:18.064301 (EE) 8: /usr/bin/Xorg (_start+0x2a) [0x1664794eb2a]
2019-Sep-12 10:11:18.064309 (EE)
2019-Sep-12 10:11:18.064318 (EE) Segmentation fault at address 0x0
The root cause is a NULL pointer dereference in strcmp because argument one (function udev_device_get_subsystem) returns NULL in the catched race - please see config/udev.c:
...
#ifdef CONFIG_UDEV_KMS
if (!strcmp(udev_device_get_subsystem(udev_device), "drm")) {
...
I've already prepared a fix for that on my udev-fix branch.
Best regards webi123