Message ID | cover.1573236684.git.andreyknvl@google.com (mailing list archive) |
---|---|
Headers | show |
Series | usb: gadget: add raw-gadget interface | expand |
On Fri, 8 Nov 2019, Andrey Konovalov wrote: > This patchset (currently a single patch) adds a new userspace interface > for the USB Gadget subsystem called USB Raw Gadget (I don't mind changing > the name to something else if there are better ideas). This is what > currently being used to enable coverage-buided USB fuzzing with syzkaller: > > https://github.com/google/syzkaller/blob/master/docs/linux/external_fuzzing_usb.md > > Initially I was using GadgetFS (together with the Dummy HCD/UDC module) > to perform emulation of USB devices for fuzzing, but later switched to a > custom written interface. The incentive to implement a different interface > was to provide a somewhat raw and direct access to the USB Gadget layer > for the userspace, where every USB request is passed to the userspace to > get a response. See documentation for the list of differences between > Raw Gadget and GadgetFS. > > This patchset has been pushed to the public Linux kernel Gerrit instance: > > https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/2144 > > Andrey Konovalov (1): > usb: gadget: add raw-gadget interface > > Documentation/usb/index.rst | 1 + > Documentation/usb/raw-gadget.rst | 60 ++ > drivers/usb/gadget/Kconfig | 9 + > drivers/usb/gadget/Makefile | 2 + > drivers/usb/gadget/raw.c | 1150 +++++++++++++++++++++++++++ As a general rule, gadget drivers don't go directly in drivers/usb/gadget. raw.c counts as a legacy driver (because it's not written to use the composite gadget framework), so it belongs in drivers/usb/gadget/legacy. That's where the gadgetfs driver lives, for example. Alan Stern > include/uapi/linux/usb/raw_gadget.h | 164 ++++ > 6 files changed, 1386 insertions(+) > create mode 100644 Documentation/usb/raw-gadget.rst > create mode 100644 drivers/usb/gadget/raw.c > create mode 100644 include/uapi/linux/usb/raw_gadget.h
On Fri, Nov 8, 2019 at 10:45 PM Alan Stern <stern@rowland.harvard.edu> wrote: > > On Fri, 8 Nov 2019, Andrey Konovalov wrote: > > > This patchset (currently a single patch) adds a new userspace interface > > for the USB Gadget subsystem called USB Raw Gadget (I don't mind changing > > the name to something else if there are better ideas). This is what > > currently being used to enable coverage-buided USB fuzzing with syzkaller: > > > > https://github.com/google/syzkaller/blob/master/docs/linux/external_fuzzing_usb.md > > > > Initially I was using GadgetFS (together with the Dummy HCD/UDC module) > > to perform emulation of USB devices for fuzzing, but later switched to a > > custom written interface. The incentive to implement a different interface > > was to provide a somewhat raw and direct access to the USB Gadget layer > > for the userspace, where every USB request is passed to the userspace to > > get a response. See documentation for the list of differences between > > Raw Gadget and GadgetFS. > > > > This patchset has been pushed to the public Linux kernel Gerrit instance: > > > > https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/2144 > > > > Andrey Konovalov (1): > > usb: gadget: add raw-gadget interface > > > > Documentation/usb/index.rst | 1 + > > Documentation/usb/raw-gadget.rst | 60 ++ > > drivers/usb/gadget/Kconfig | 9 + > > drivers/usb/gadget/Makefile | 2 + > > drivers/usb/gadget/raw.c | 1150 +++++++++++++++++++++++++++ > > As a general rule, gadget drivers don't go directly in > drivers/usb/gadget. raw.c counts as a legacy driver (because it's not > written to use the composite gadget framework), so it belongs in > drivers/usb/gadget/legacy. That's where the gadgetfs driver lives, for > example. Hi Alan! Sure, I'll move it to legacy/ in v2. Thanks!
On Fri, Nov 8, 2019 at 11:18 PM Andrey Konovalov <andreyknvl@google.com> wrote: > > On Fri, Nov 8, 2019 at 10:45 PM Alan Stern <stern@rowland.harvard.edu> wrote: > > > > On Fri, 8 Nov 2019, Andrey Konovalov wrote: > > > > > This patchset (currently a single patch) adds a new userspace interface > > > for the USB Gadget subsystem called USB Raw Gadget (I don't mind changing > > > the name to something else if there are better ideas). This is what > > > currently being used to enable coverage-buided USB fuzzing with syzkaller: > > > > > > https://github.com/google/syzkaller/blob/master/docs/linux/external_fuzzing_usb.md > > > > > > Initially I was using GadgetFS (together with the Dummy HCD/UDC module) > > > to perform emulation of USB devices for fuzzing, but later switched to a > > > custom written interface. The incentive to implement a different interface > > > was to provide a somewhat raw and direct access to the USB Gadget layer > > > for the userspace, where every USB request is passed to the userspace to > > > get a response. See documentation for the list of differences between > > > Raw Gadget and GadgetFS. > > > > > > This patchset has been pushed to the public Linux kernel Gerrit instance: > > > > > > https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/2144 > > > > > > Andrey Konovalov (1): > > > usb: gadget: add raw-gadget interface > > > > > > Documentation/usb/index.rst | 1 + > > > Documentation/usb/raw-gadget.rst | 60 ++ > > > drivers/usb/gadget/Kconfig | 9 + > > > drivers/usb/gadget/Makefile | 2 + > > > drivers/usb/gadget/raw.c | 1150 +++++++++++++++++++++++++++ > > > > As a general rule, gadget drivers don't go directly in > > drivers/usb/gadget. raw.c counts as a legacy driver (because it's not > > written to use the composite gadget framework), so it belongs in > > drivers/usb/gadget/legacy. That's where the gadgetfs driver lives, for > > example. > > Hi Alan! Sure, I'll move it to legacy/ in v2. Thanks! Hi Alan, Should I move CONFIG_USB_RAW_GADGET into legacy/Kconfig as well? AFAIU this makes it impossible to turn on e.g. both GadgetFS and Raw Gadget at the same time, since they both become options of the same choice. Thanks!
On Thu, 14 Nov 2019, Andrey Konovalov wrote: > > > As a general rule, gadget drivers don't go directly in > > > drivers/usb/gadget. raw.c counts as a legacy driver (because it's not > > > written to use the composite gadget framework), so it belongs in > > > drivers/usb/gadget/legacy. That's where the gadgetfs driver lives, for > > > example. > > > > Hi Alan! Sure, I'll move it to legacy/ in v2. Thanks! > > Hi Alan, > > Should I move CONFIG_USB_RAW_GADGET into legacy/Kconfig as well? AFAIU > this makes it impossible to turn on e.g. both GadgetFS and Raw Gadget > at the same time, since they both become options of the same choice. We can probably live with that. Not many people will want to build the Raw Gadget driver, and even fewer will want it together with gadgetfs. But if you want to keep the Kconfig option in the higher-level directory, that's probably okay. Alan Stern