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: <Pine.LNX.4.44L0.1605181206580.1981-100000@iolanthe.rowland.org>
Date:	Wed, 18 May 2016 12:09:39 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Andrey Ryabinin <ryabinin.a.a@...il.com>
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

On Wed, 18 May 2016, Andrey Ryabinin wrote:

> 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;

Really?  That's a lot simpler.  But will it also fool gcc?  That is, 
will it prevent gcc from optimizing away the !wIndex tests below?

How about this patch?

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,9 +872,10 @@ 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 = ehci->regs->port_status +
+				((wIndex & 0xff) - 1);
+	u32 __iomem	*hostpc_reg = ehci->regs->hostpc +
+				((wIndex & 0xff) - 1);
 	u32		temp, temp1, status;
 	unsigned long	flags;
 	int		retval = 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ