Andi Konovalov from Google is developing a new module , to emulate USB devices in user space. Currently under review to include this module in the main body of the Linux kernel. USB Raw Gadget is already at Google for simplifying fuzz testing of the USB stack in the kernel using tools .
The module adds a new programming interface to the kernel's and is developed as an alternative to GadgetFS. The creation of a new API is due to the need for low-level and direct access to the USB Gadget subsystem from user space, allowing for handling all possible USB requests (GadgetFS processes some requests itself, not passing them to user space). Management of the USB Raw Gadget is done through the device /dev/raw-gadget similar to /dev/gadget in GadgetFS, but for interaction a ioctl()-based interface is used instead of a pseudo-FS.
In addition to directly processing all USB requests by the process in user space, the new interface also features the ability to return any data in response to a USB request (GadgetFS performs checks on USB descriptors and filters certain responses, which hinders error identification during fuzz testing of the USB stack). Raw Gadget also allows for selecting a specific UDC (USB Device Controller) and driver for attachment, while GadgetFS attaches to the first available UDC. Predictable names are assigned to different UDCs to separate different types of data exchange channels within a single device.
Burimi: opennet.ru
