aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-usbgen
Commit message (Collapse)AuthorAgeFilesLines
* tools/usbgen: extract driver namesAndrey Konovalov2025-08-212-39/+74
| | | | | | | | | | Change the kernel patch and the syz-usbgen tool to split the extracted USB IDs by the driver they belong to. This will allow for a more precise patching of class/driver-specific USB descriptors. Also update USB IDs with Linux kernel 6.16.
* tools/syz-usbgen: update dumping patchAndrey Konovalov2024-07-251-16/+8
| | | | Make it work on newer kernels.
* all: ioutil is deprecated in go1.19 (#3718)Taras Madan2023-02-231-2/+1
|
* tools/usbgen: handle zero id count casePavel Skripkin2021-09-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I wanted to fuzz only one driver, so I've slightly changed usb_ids.patch to print ids only for needed driver: So, I got following vm log: syzkaller login: [ 34.303492] hid: USBID: 0300da0b79810000000000000000000000 [ 34.303969] hid: USBID: 0300da0b79010000000000000000000000 [ 34.304454] hid: USBID: 0300da0b79f10000000000000000000000 [ 34.304988] hid: USBID: 0300b80779810000000000000000000000 [ 34.305455] hid: USBID: 0300f60d76000000000000000000000000 [ 34.305941] hid: USBID: 030001200f330000000000000000000000 [ 34.306406] hid: USBID: 0300012010330000000000000000000000 [ 34.306893] hid: USBID: 0300012011330000000000000000000000 [ 34.307364] hid: USBID: 030001201b330000000000000000000000 [ 34.307865] hid: USBID: 03006e0508400000000000000000000000 [ 34.308349] hid: USBID: 030057230c010000000000000000000000 [ 34.308847] hid: USBID: 0300572311010000000000000000000000 [ 34.309328] hid: USBID: 03004e2c02010000000000000000000000 [ 34.309826] hid: USBID: 0300050bf0180000000000000000000000 [ 34.310307] hid: USBID: 0300927311b80000000000000000000000 QEMU: Terminated There is no HID devices in log at all. Old syz-usbgen generates following init_vusb_ids.go: // Code generated by tools/syz-usbgen. DO NOT EDIT. // See docs/linux/external_fuzzing_usb.md package linux var usbIds = "\x03\x00\x01 \x0f3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\x01 \x103\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\x01 \x113\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\x01 \x1b3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\x05\v\xf0\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00N,\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00W#\f\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00W#\x11\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00n\x05\b@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\x92s\x11\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\xb8\ay\x81\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\xda\vy\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\xda\vy\x81\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\xda\vy\xf1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x00\xf6\rv\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" var hidIds = It obviously causes build errors: sys/linux/init_vusb_ids.go:23:1: syntax error: unexpected EOF, expecting expression make: *** [Makefile:172: mutate] Error 2 make: *** Waiting for unfinished jobs.... sys/linux/init_vusb_ids.go:23:1: syntax error: unexpected EOF, expecting expression make: *** [Makefile:175: prog2c] Error 2 sys/linux/init_vusb_ids.go:23:1: syntax error: unexpected EOF, expecting expression sys/linux/init_vusb_ids.go:23:1: syntax error: unexpected EOF, expecting expression sys/linux/init_vusb_ids.go:23:1: syntax error: unexpected EOF, expecting expression make: *** [Makefile:169: repro] Error 2 Fix it by adding empty string to output when len(ids) is equal to zero Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
* tools/syz-usbgen: fix usb_ids.patchPavel Skripkin2021-09-101-16/+16
| | | | | | | | | | | | | | | | | Previous patch causes build error on top of v5.14: error: ‘usb_bus_type’ undeclared (first use in this function); did you mean ‘hid_bus_type’? 2299 | bus_for_each_drv(&usb_bus_type, NULL, NULL, usb_device_id_dump_driver); | ^~~~~~~~~~~~ | hid_bus_type Fix it by including drivers/usb/core/usb.h where usb_bus_type declaration is. Also, removed duplicate is_usb_device_driver definition, since it's already in drivers/usb/core/usb.h. Tested localy on qemu Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
* all: use tool.Failf instead of local functionsDmitry Vyukov2020-12-251-8/+4
|
* all: fix marking of auto-generated filesDmitry Vyukov2020-07-291-6/+6
| | | | | Update the copyright checking script and more files for the standard convention of marking auto-generated files.
* docs: link github.com/xairy/raw-gadgetAndrey Konovalov2020-02-061-657/+0
|
* executor: update raw gadget interfaceAndrey Konovalov2019-12-111-5/+7
|
* executor, pkg/host: update usb raw-gadget interfaceAndrey Konovalov2019-11-151-16/+16
| | | | The patches are being upstreamed and the interface has changed.
* tools/syz-usbgen: update patch to dump usb idsAndrey Konovalov2019-11-151-30/+62
| | | | The patch doesn't properly work on some kernels, some ids might not be printed.
* executor: update the list of raw usb eventsAndrey Konovalov2019-11-051-8/+0
| | | | The number of reported event types changed.
* executor, pkg/host, dashboard/config: rename usb-fuzzer to usb raw-gadgetAndrey Konovalov2019-11-041-85/+82
| | | | The interface is being upstreamed and the name has changed.
* tools/syz-usbgen: handle USB_DT_DEVICE_QUALIFIER in keyboard.cAndrey Konovalov2019-09-191-0/+16
|
* tools/syz-usbgen: ignore building keyboard.cAndrey Konovalov2019-09-041-0/+2
|
* docs: update USB fuzzing documentationAndrey Konovalov2019-09-041-0/+648
|
* sys/linux: extract USB HID ids (#1294)Andrey Konovalov2019-07-222-34/+119
| | | | | | | | | | | | | | | | | | * sys/linux: extract USB HID ids As it turns out the HID kernel subsystem registers only one USB driver that checks that the interface of the connected device has HID class and then looks up its own list of vendor/device ids to find a matching driver. This means that we currently don't generate proper vendor/device ids for USB HID devices. This patch updates the syz-usbgen tool to also extract USB HID vendor/device ids from a running kernel and makes the generated descriptions for HID devices to be patched using the extracted ids. This patch also contains some minor improvements to USB descriptions (better HID descriptions and more replies for some USB classes/drivers). * sys/linux: run make generate
* sys: add USB descriptionsAndrey Konovalov2019-04-112-0/+124
This commit adds syzkaller descriptions for USB fuzzing. The descriptions in vusb.txt are written manually and cover different kinds of USB descriptors. The descriptions in init_vusb_ids.go are generated automanitally by the syz-usbgen tool and contain the vendor, device and some other IDs that map to different USB drivers.