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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 22 Aug 2016 16:40:32 -0400 (EDT)
From:   Alan Stern <stern@...land.harvard.edu>
To:     Bjørn Mork <bjorn@...k.no>
cc:     Jiri Slaby <jslaby@...e.cz>, Vittorio Zecca <zeccav@...il.com>,
        <stable@...r.kernel.org>, USB list <linux-usb@...r.kernel.org>,
        Linux kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25

On Mon, 22 Aug 2016, Bjørn Mork wrote:

> Alan Stern <stern@...land.harvard.edu> writes:
> 
> > On Sun, 21 Aug 2016, Jiri Slaby wrote:
> >
> >> Cc: proper lists.
> >> 
> >> ep->desc.bInterval seems to be 0 here.

> > As far as I can see, this isn't possible.  The usb_parse_endpoint()  
> > routine in drivers/usb/core/config.c is supposed to guarantee that
> > ep->desc.bInterval is never 0.
> 
> That is if it is an ISO endpoint, right?

I can't tell; the bug report doesn't say.  However, ep->desc.bInterval 
is ignored for bulk and control endpoints, so it must be either 
isochronous or interrupt.

> Maybe I misunderstand something fundamental, but the "||" strikes me as
> odd here:
> 
>         as->urb->stream_id = stream_id;
>         if (uurb->type == USBDEVFS_URB_TYPE_ISO ||
>                         ps->dev->speed == USB_SPEED_HIGH)
>                 as->urb->interval = 1 << min(15, ep->desc.bInterval - 1);
>         else
>                 as->urb->interval = ep->desc.bInterval;
>         as->urb->context = as;

No, that's right (mostly -- we really should check for ps->dev->speed 
>= USB_SPEED_SUPER as well as == USB_SPEED_HIGH).

> Typo?

USB uses two different encodings for endpoint intervals.  The second
encoding above just gives the interval in frames; this is used for low-
and full-speed interrupt endpoints.  The first encoding above is
exponential (it gives n where the actual interval is 2^(n-1) frames or
microframes); this is used for all isochronous endpoints and for
high-speed (or SuperSpeed etc.) interrupt endpoints.

See for example the definition of usb_fill_int_urb() in 
include/linux/usb.h.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ