lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 9 May 2020 15:23:25 +0200
From:   Andrey Konovalov <andreyknvl@...gle.com>
To:     Felipe Balbi <balbi@...nel.org>
Cc:     USB list <linux-usb@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Alan Stern <stern@...land.harvard.edu>,
        Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [PATCH USB v3 3/5] usb: raw-gadget: fix gadget endpoint selection

On Sat, May 9, 2020 at 10:00 AM Felipe Balbi <balbi@...nel.org> wrote:
>
> Andrey Konovalov <andreyknvl@...gle.com> writes:
>
> > Currently automatic gadget endpoint selection based on required features
> > doesn't work. Raw Gadget tries iterating over the list of available
> > endpoints and finding one that has the right direction and transfer type.
> > Unfortunately selecting arbitrary gadget endpoints (even if they satisfy
> > feature requirements) doesn't work, as (depending on the UDC driver) they
> > might have fixed addresses, and one also needs to provide matching
> > endpoint addresses in the descriptors sent to the host.
> >
> > The composite framework deals with this by assigning endpoint addresses
> > in usb_ep_autoconfig() before enumeration starts. This approach won't work
> > with Raw Gadget as the endpoints are supposed to be enabled after a
> > set_configuration/set_interface request from the host, so it's too late to
> > patch the endpoint descriptors that had already been sent to the host.
> >
> > For Raw Gadget we take another approach. Similarly to GadgetFS, we allow
> > the user to make the decision as to which gadget endpoints to use.
> >
> > This patch adds another Raw Gadget ioctl USB_RAW_IOCTL_EPS_INFO that
> > exposes information about all non-control endpoints that a currently
> > connected UDC has. This information includes endpoints addresses, as well
> > as their capabilities and limits to allow the user to choose the most
> > fitting gadget endpoint.
> >
> > The USB_RAW_IOCTL_EP_ENABLE ioctl is updated to use the proper endpoint
> > validation routine usb_gadget_ep_match_desc().
> >
> > These changes affect the portability of the gadgets that use Raw Gadget
> > when running on different UDCs. Nevertheless, as long as the user relies
> > on the information provided by USB_RAW_IOCTL_EPS_INFO to dynamically
> > choose endpoint addresses, UDC-agnostic gadgets can still be written with
> > Raw Gadget.
> >
> > Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface")
> > Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
> > ---
>
> you're adding a new IOCTL, how is this a fix?

It's a fix in a sense that without this patch a user can't make
raw-gadget work with other UDCs besides dummy, and with this patch it
works (at least with dwc2 I'm currently using for tests).

I guess I could split this patch into two, one that removes the failed
attempt to auto-assign endpoints, and another one that adds the new
ioctl. Should I do that?

Powered by blists - more mailing lists