From: Andrey Konovalov <andreyknvl@google.com>
To: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Felipe Balbi <balbi@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
Alan Stern <stern@rowland.harvard.edu>,
Dmitry Vyukov <dvyukov@google.com>,
Alexander Potapenko <glider@google.com>,
Marco Elver <elver@google.com>,
Andrey Konovalov <andreyknvl@google.com>
Subject: [PATCH v5 0/1] usb: gadget: add raw-gadget interface
Date: Tue, 14 Jan 2020 14:24:42 +0100 [thread overview]
Message-ID: <cover.1579007786.git.andreyknvl@google.com> (raw)
This patchset (currently a single patch) adds a new userspace interface
for the USB Gadget subsystem called USB Raw Gadget. This is what is
currently being used to enable coverage-guided 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
Changes v4 -> v5:
- Specified explicit usb_raw_event_type enum values for all entries.
- Dropped pointless locking in gadget_unbind().
Changes v3 -> v4:
- Print debug message when maxpacket check fails.
- Use module_misc_device() instead of module_init/exit().
- Reuse DRIVER_NAME macro in raw_device struct definition.
- Don't print WARNING in raw_release().
- Add comment that explains locking into raw_event_queue_fetch().
- Print a WARNING when event queue size is exceeded.
- Rename raw.c to raw_gadget.c.
- Mention module name in Kconfig.
- Reworked logging to use dev_err/dbg() instead of pr_err/debug().
Changes v2 -> v3:
- Updated device path in documentation.
- Changed usb_raw_init struct layout to make it the same for 32 bit compat
mode.
- Added compat_ioctl to raw_fops.
- Changed raw_ioctl_init() to return EINVAL for invalid USB speeds, except
for USB_SPEED_UNKNOWN, which defaults to USB_SPEED_HIGH.
- Reject endpoints with maxpacket = 0 in raw_ioctl_ep_enable().
Changes v1 -> v2:
- Moved raw.c to legacy/.
- Changed uapi header to use __u* types.
- Switched from debugfs entry to a misc device.
- Changed raw_dev from refcount to kref.
- Moved UDC_NAME_LENGTH_MAX to uapi headers.
- Used usb_endpoint_type() and usb_endpoint_dir_in/out() functions instead
of open coding them.
- Added "WITH Linux-syscall-note" to SPDX id in the uapi header.
- Removed pr_err() if case dev_new() fails.
- Reduced the number of debugging messages.
Andrey Konovalov (1):
usb: gadget: add raw-gadget interface
Documentation/usb/index.rst | 1 +
Documentation/usb/raw-gadget.rst | 59 ++
drivers/usb/gadget/legacy/Kconfig | 11 +
drivers/usb/gadget/legacy/Makefile | 1 +
drivers/usb/gadget/legacy/raw_gadget.c | 1068 ++++++++++++++++++++++++
include/uapi/linux/usb/raw_gadget.h | 167 ++++
6 files changed, 1307 insertions(+)
create mode 100644 Documentation/usb/raw-gadget.rst
create mode 100644 drivers/usb/gadget/legacy/raw_gadget.c
create mode 100644 include/uapi/linux/usb/raw_gadget.h
--
2.25.0.rc1.283.g88dfdc4193-goog
next reply other threads:[~2020-01-14 13:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 13:24 Andrey Konovalov [this message]
2020-01-14 13:24 ` [PATCH v5 1/1] usb: gadget: add raw-gadget interface Andrey Konovalov
2020-01-14 14:00 ` Greg Kroah-Hartman
2020-01-22 14:37 ` Andrey Konovalov
2020-01-22 14:50 ` Greg Kroah-Hartman
2020-01-27 12:27 ` Andrey Konovalov
2020-01-31 13:42 ` Felipe Balbi
2020-01-31 14:43 ` Andrey Konovalov
2020-01-31 15:22 ` Felipe Balbi
2020-02-03 18:08 ` Andrey Konovalov
2020-02-05 16:42 ` Felipe Balbi
2020-02-05 17:25 ` Andrey Konovalov
2020-02-05 21:18 ` Greg Kroah-Hartman
2020-02-06 6:19 ` Felipe Balbi
2020-02-06 19:21 ` Andrey Konovalov
2020-02-05 21:18 ` Greg Kroah-Hartman
2020-02-06 6:14 ` Felipe Balbi
2020-01-31 21:42 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1579007786.git.andreyknvl@google.com \
--to=andreyknvl@google.com \
--cc=balbi@kernel.org \
--cc=corbet@lwn.net \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).