[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023062950-landowner-goofiness-d5d2@gregkh>
Date: Thu, 29 Jun 2023 21:17:23 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Kees Cook <keescook@...omium.org>
Cc: Borislav Petkov <bp@...en8.de>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Jó Ágila Bitsch <jgilab@...il.com>,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] usb: ch9: Replace bmSublinkSpeedAttr 1-element array
with flexible array
On Thu, Jun 29, 2023 at 12:09:00PM -0700, Kees Cook wrote:
> Since commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3"),
> UBSAN_BOUNDS no longer pretends 1-element arrays are unbounded. Walking
> bmSublinkSpeedAttr will trigger a warning, so make it a proper flexible
> array. Add a union to keep the struct size identical for userspace in
> case anything was depending on the old size.
>
> False positive warning was:
>
> UBSAN: array-index-out-of-bounds in drivers/usb/host/xhci-hub.c:231:31 index 1 is out of range for type '__le32 [1]'
>
> for this line of code:
>
> ssp_cap->bmSublinkSpeedAttr[offset++] = cpu_to_le32(attr);
>
> Reported-by: Borislav Petkov <bp@...en8.de>
> Closes: https://lore.kernel.org/lkml/2023062945-fencing-pebble-0411@gregkh/
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> include/uapi/linux/usb/ch9.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Thanks for the quick response, I'll queue it up after 6.5-rc1 is out.
Boris, can you test if this fixes the issue you see or not?
greg k-h
Powered by blists - more mailing lists