USB Raw Gadget, a Linux module for emulating USB devices, is available

Andrey Konovalov from Google is developing a new module USB Raw Gadget, allowing emulate USB devices in user space. Is pending application to include this module in the main part of the Linux kernel. USB Raw Gadget already applies at Google to facilitate fuzz testing of the kernel USB stack using toolkit syzkaller.

The module adds a new programming interface to the kernel subsystem USB Gadget and is being developed as an alternative to GadgetFS. The creation of a new API is due to the need to obtain low-level and direct access to the USB Gadget subsystem from user space, allowing it to process all possible USB requests (GadgetFS processes some requests on its own, without passing it to user space). The USB Raw Gadget is managed through the /dev/raw-gadget device, similar to /dev/gadget in GadgetFS, but the interaction uses an ioctl()-based interface rather than a pseudo-FS.

In addition to directly processing all USB requests by a user-space process, the new interface also features the ability to return any data in response to a USB request (GadgetFS performs USB descriptor validation and filters certain responses, which prevents detection of errors during USB stack fuzzing testing) . The Raw Gadget also allows you to select a specific UDC (USB Device Controller) device and driver to attach, while GadgetFS attaches to the first available UDC device. Predictable names assigned to different UDCs endpoint to separate different types of data exchange channels within one device.

Source: opennet.ru

Add a comment