From: Kees Cook <keescook@chromium.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: oe-lkp@lists.linux.dev, lkp@intel.com,
kernel test robot <oliver.sang@intel.com>,
Linux Memory Management List <linux-mm@kvack.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>,
linux-kbuild@vger.kernel.org, llvm@lists.linux.dev,
linux-hardening@vger.kernel.org
Subject: Re: [linux-next:master] [kbuild] df8fc4e934: BUG:unable_to_handle_page_fault_for_address
Date: Tue, 13 Jun 2023 13:58:42 -0700 [thread overview]
Message-ID: <202306131354.A499DE60@keescook> (raw)
In-Reply-To: <202306131342.51A51F651C@keescook>
On Tue, Jun 13, 2023 at 01:46:54PM -0700, Kees Cook wrote:
> On Sun, Jun 11, 2023 at 09:41:30PM +0800, kernel test robot wrote:
> > the issue we found below is by clang-15, but we confirmed clang-15 we use is
> > commit 8dfdcc7b7b in llvm-project. it supports the flag already.
>
> Interesting! Thanks for the report.
>
> > [ 228.605608][ C1] BUG: unable to handle page fault for address: 04090300
> > [...]
> > [ 228.608262][ C1] EIP: string (lib/vsprintf.c:644 lib/vsprintf.c:726)
> > [...]
> > [ 228.608262][ C1] Call Trace:
> > [ 228.608262][ C1] <SOFTIRQ>
> > [ 228.608262][ C1] vsnprintf (lib/vsprintf.c:2817)
> > [ 228.608262][ C1] vprintk_store (kernel/printk/printk.c:2191)
> > [ 228.608262][ C1] vprintk_emit (kernel/printk/printk.c:2288)
> > [ 228.608262][ C1] vprintk_default (kernel/printk/printk.c:2318)
> > [ 228.608262][ C1] vprintk (kernel/printk/printk_safe.c:50)
> > [ 228.608262][ C1] _printk (kernel/printk/printk.c:2331)
> > [ 228.608262][ C1] __ubsan_handle_out_of_bounds (lib/ubsan.c:209 lib/ubsan.c:343)
>
> This is a crash within the UBSAN handler! That's very unexpected.
I still don't understand this. Is printk() not allowed in SOFTIRQ?
> > [ 228.608262][ C1] get_string (drivers/usb/gadget/composite.c:1314)
> > [ 228.608262][ C1] composite_setup (drivers/usb/gadget/composite.c:1871)
> > [ 228.608262][ C1] dummy_timer (drivers/usb/gadget/udc/dummy_hcd.c:?)
>
> And the out-of-bounds condition got triggered in dummy_hcd.
I found this. I'm surprised we didn't trip over it earlier!
/* USB_DT_STRING: String descriptor */
struct usb_string_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__le16 wData[1]; /* UTF-16LE encoded */
} __attribute__ ((packed));
$ git grep 'struct usb_string_descriptor'
drivers/usb/early/xhci-dbc.c: struct usb_string_descriptor *s_desc;
drivers/usb/early/xhci-dbc.c: s_desc = (struct usb_string_descriptor *)strings->serial;
drivers/usb/early/xhci-dbc.c: s_desc = (struct usb_string_descriptor *)strings->product;
drivers/usb/early/xhci-dbc.c: s_desc = (struct usb_string_descriptor *)strings->manufacturer;
drivers/usb/gadget/composite.c: struct usb_string_descriptor *s = buf;
drivers/usb/gadget/udc/aspeed-vhub/hub.c: struct usb_string_descriptor *sdesc = buf;
drivers/usb/host/xhci-dbgcap.c: struct usb_string_descriptor *s_desc;
drivers/usb/host/xhci-dbgcap.c: s_desc = (struct usb_string_descriptor *)strings->serial;
drivers/usb/host/xhci-dbgcap.c: s_desc = (struct usb_string_descriptor *)strings->product;
drivers/usb/host/xhci-dbgcap.c: s_desc = (struct usb_string_descriptor *)strings->manufacturer;
include/uapi/linux/usb/ch9.h:struct usb_string_descriptor {
Looking at each use, none are using sizeof() on the struct, so it should
be a trivial replacement. I'll send a patch.
-Kees
--
Kees Cook
prev parent reply other threads:[~2023-06-13 20:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-11 13:41 kernel test robot
2023-06-13 20:46 ` Kees Cook
2023-06-13 20:58 ` Kees Cook [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202306131354.A499DE60@keescook \
--to=keescook@chromium.org \
--cc=gustavoars@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox