tests_kernel.test_usb_crash module
- class TestUSBDevice
Bases:
TestUhidTest class to test if an emulated USB device crashes the kernel.
- new_uhdev(usbVidPid, request)
- test_creation()
inject the USB dev through uhid and immediately see if there is a crash:
uhid can create a USB device with the BUS_USB bus, and some drivers assume that they can then access USB related structures when they are actually provided a uhid device. This leads to a crash because those access result in a segmentation fault.
The kernel should not crash on any (random) user space correct use of its API. So run through all available modules and declared devices to see if we can generate a uhid device without a crash.
The test is empty as the fixture check_taint is doing the job (and honestly, when the kernel crashes, the whole machine freezes).
- class USBDev(name=None, input_info=None)
Bases:
UHIDTestDevice- get_evdev(application=None)
- is_ready()
Returns whether a UHID device is ready. Can be overwritten in subclasses to add extra conditions on when to consider a UHID device ready. This can be:
we need to wait on different types of input devices to be ready (Touch Screen and Pen for example)
we need to have at least 4 LEDs present (len(self.uhdev.leds_classes) == 4)
or any other combinations
- report_descriptor = [5, 1, 9, 2, 161, 1, 9, 2, 161, 2, 9, 1, 161, 0, 5, 9, 25, 1, 41, 3, 21, 0, 37, 1, 117, 1, 149, 3, 129, 2, 117, 5, 149, 1, 129, 3, 5, 1, 9, 48, 9, 49, 21, 129, 37, 127, 117, 8, 149, 2, 129, 6, 192, 192, 192]