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]
Message-ID: <CAPAsAGxF9uChs4FM0jVw3NV=X+9m=zkBudjEqjuqtBAwhgtA+g@mail.gmail.com>
Date:	Wed, 18 May 2016 18:02:02 +0300
From:	Andrey Ryabinin <ryabinin.a.a@...il.com>
To:	Alan Stern <stern@...land.harvard.edu>
Cc:	Oliver Neukum <oneukum@...e.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	LKML <linux-kernel@...r.kernel.org>, linux-usb@...r.kernel.org,
	Valdis Kletnieks <Valdis.Kletnieks@...edu>
Subject: Re: UBSAN whinge in ihci-hub.c

2016-05-18 17:40 GMT+03:00 Alan Stern <stern@...land.harvard.edu>:

> All right, I'm getting very tired of all these bug reports.  Besides,
> Andrey has a point: Unless you're Linus, arguing against the C standard
> is futile.  (Even though the language dialect used in the kernel is not
> standard C.)
>
> Does this patch make UBSAN happy?  The runtime overhead is minimal.
>

It does. However, you could fool ubsan way more easy:
             u32 __iomem     *hostpc_reg = ehci->regs->hostpc +
(wIndex & 0xff) - 1;



> Alan Stern
>
>
>
> Index: usb-4.x/drivers/usb/host/ehci-hub.c
> ===================================================================
> --- usb-4.x.orig/drivers/usb/host/ehci-hub.c
> +++ usb-4.x/drivers/usb/host/ehci-hub.c
> @@ -872,14 +872,17 @@ int ehci_hub_control(
>  ) {
>         struct ehci_hcd *ehci = hcd_to_ehci (hcd);
>         int             ports = HCS_N_PORTS (ehci->hcs_params);
> -       u32 __iomem     *status_reg = &ehci->regs->port_status[
> -                               (wIndex & 0xff) - 1];
> -       u32 __iomem     *hostpc_reg = &ehci->regs->hostpc[(wIndex & 0xff) - 1];
> +       u32 __iomem     *status_reg, *hostpc_reg;
>         u32             temp, temp1, status;
>         unsigned long   flags;
>         int             retval = 0;
>         unsigned        selector;
>
> +       temp = wIndex & 0xff;
> +       temp -= (temp > 0);
> +       status_reg = &ehci->regs->port_status[temp];
> +       hostpc_reg = &ehci->regs->hostpc[temp];
> +
>         /*
>          * FIXME:  support SetPortFeatures USB_PORT_FEAT_INDICATOR.
>          * HCS_INDICATOR may say we can change LEDs to off/amber/green.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ