aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/init_vusb.go
Commit message (Collapse)AuthorAgeFilesLines
* sys/linux: patch in hardcoded USB IDs for USB printer driverAndrey Konovalov2025-08-211-9/+27
| | | | | | | | | | | | | | Some USB drivers contain quirks (special handling code) for USB devices with specific USB IDs. Sometimes the IDs for these quirks are encoded in the driver matching rules (and thus are auto-extracted into sys/linux/init_vusb_ids.go), but sometimes these IDs are hardcoded in the driver itself. This patch extends the generateUsbPrinterDeviceDescriptor function to also sometimes generate USB IDs to exercise the hardcoded quirks for the USB printer class. Similar functionality can be implemented for other USB drivers later.
* sys/linux: patch in auto-extracted USB IDs for printer classAndrey Konovalov2025-08-211-16/+69
| | | | | | | | | | This allows exercising driver quirks that might be defined in the matching rules (the printer driver does not actually define any yet, but this change serves as a reference for doing this for other drivers). Only patch in the IDs that are used in the matching rules of the printer driver in the kernel. Patching other IDs might subvert the kernel into matching the emulated device to a different driver.
* sys/linux: reorganize generateUsbDeviceDescriptorAndrey Konovalov2025-08-211-8/+12
| | | | | | Introduce a helper function to make the following changes cleaner. No functional changes.
* tools/usbgen: extract driver namesAndrey Konovalov2025-08-211-4/+4
| | | | | | | | | | 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.
* sys/linux: clone args before mutationAleksandr Nogikh2024-03-131-2/+2
| | | | | | | | Not cloning the argument results in replaceArg() replacing a union argument with itself, which may lead to inconsistent resource references. Add an assertion to detect such cases in the future.
* Revert "sys/linux: clone args before mutation"Aleksandr Nogikh2024-03-081-2/+2
| | | | This reverts commit 4097c8d7a8596ddbc9a9db7b7f39c5cbdb1bd742.
* sys/linux: clone args before mutationAleksandr Nogikh2024-03-081-2/+2
| | | | | | | | Not cloning the argument results in replaceArg() replacing a union argument with itself, which may lead to inconsistent resource references. Add an assertion to detect such cases in the future.
* .golangci.yml: enable whitespace checkerDmitry Vyukov2020-06-051-2/+0
| | | | Points to bad empty lines very precisely.
* prog: introduce Field typeDmitry Vyukov2020-05-021-4/+5
| | | | | | | | | | | | | Remvoe FieldName from Type and add a separate Field type that holds field name. Use Field for struct fields, union options and syscalls arguments, only these really have names. Reduces size of sys/linux/gen/amd64.go from 5665583 to 5201321 (-8.2%). Allows to not create new type for squashed any pointer. But main advantages will follow, e.g. removing StructDesc, using TypeRef in Arg, etc. Update #1580
* prog: remove Dir from TypeDmitry Vyukov2020-05-011-4/+4
| | | | | | | | | | | | | | | | | | Having Dir is Type is handy, but forces us to duplicate lots of types. E.g. if a struct is referenced as both in and out, then we need to have 2 copies and 2 copies of structs/types it includes. If also prevents us from having the struct type as struct identity (because we can have up to 3 of them). Revert to the old way we used to do it: propagate Dir as we walk syscall arguments. This moves lots of dir passing from pkg/compiler to prog package. Now Arg contains the dir, so once we build the tree, we can use dirs as before. Reduces size of sys/linux/gen/amd64.go from 6058336 to 5661150 (-6.6%). Update #1580
* sys/linux, executor: basic support for multiple USB interfacesAndrey Konovalov2019-09-061-18/+31
|
* sys/linux: extract USB HID ids (#1294)Andrey Konovalov2019-07-221-0/+38
| | | | | | | | | | | | | | | | | | * 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/linux: use template based structure for USB descriptionsAndrey Konovalov2019-06-071-9/+10
| | | | | | | | To allow future extensions of USB descriptions to fuzz particular USB classes this patch changes the structure of USB descriptions to use templates. This will invalidate all existing USB corpus.
* all: add basic USB fuzzing supportAndrey Konovalov2019-04-111-0/+127
This commits implements 4 syzcalls: syz_usb_connect, syz_usb_io_control, syz_usb_ep_write and syz_usb_disconnect. Those syzcalls are used to emit USB packets through a custom GadgetFS-like interface (currently exposed at /sys/kernel/debug/usb-fuzzer), which requires special kernel patches. USB fuzzing support is quite basic, as it mostly covers only the USB device enumeration process. Even though the syz_usb_ep_write syzcall does allow to communicate with USB endpoints after the device has been enumerated, no coverage is collected from that code yet.