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:	Fri, 20 May 2016 10:34:29 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Valdis Kletnieks <Valdis.Kletnieks@...edu>
cc:	Andrey Ryabinin <ryabinin.a.a@...il.com>,
	Oliver Neukum <oneukum@...e.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	<linux-kernel@...r.kernel.org>, <linux-usb@...r.kernel.org>
Subject: Re: [PATCH] - silence UBSAN complaint in ehci-hcd.

On Thu, 19 May 2016, Valdis Kletnieks wrote:

> UBSAN throws a complaint:
> 
> [    2.418579] UBSAN: Undefined behaviour in drivers/usb/host/ehci-hub.c:877:47
> [    2.418582] index -1 is out of range for type 'u32 [1]'
> 
> though it's only on the hostpc[] part, not  on the port_status[] on the
> previous line which has the same exact index calculation.  The root cause is
> that the first declaration is port_status[0], which uses a GCC extension and
> UBSAN is smart enough to realize the programmer is doing something
> intentionally odd.
> 
> However, the problematic declaration is hostpc[1], which doesn't have
> the "I know what I'm doing" semantics of [0].  Change the declaration to match.
> 
> Signed-Off-By: Valdis Kletnieks <valdis.kletnieks@...edu>
> 
> --- a/include/linux/usb/ehci_def.h	2015-01-06 01:04:24.342436706 -0500
> +++ b/include/linux/usb/ehci_def.h	2016-05-19 13:57:20.869304540 -0400
> @@ -180,11 +180,11 @@ struct ehci_regs {
>   * PORTSCx
>   */
>  	/* HOSTPC: offset 0x84 */
> -	u32		hostpc[1];	/* HOSTPC extension */
> +	u32		hostpc[0];	/* HOSTPC extension */
>  #define HOSTPC_PHCD	(1<<22)		/* Phy clock disable */
>  #define HOSTPC_PSPD	(3<<25)		/* Port speed detection */
>  
> -	u32		reserved5[16];
> +	u32		reserved5[17];
>  
>  	/* USBMODE_EX: offset 0xc8 */
>  	u32		usbmode_ex;	/* USB Device mode extension */

Is this problem still present with my latest patch 
(http://marc.info/?l=linux-usb&m=146368979514228&w=2)?

I agree that this is a reasonable change to make in any case.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ