Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2501275ybe; Tue, 3 Sep 2019 13:59:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxS0tFhUE4LrNl83PHEQB4JMZSk8dKoFIZieCCapTFtTONbWGeU5TVjPizi8i4VTeFj8gVJ X-Received: by 2002:a63:4404:: with SMTP id r4mr31439617pga.245.1567544388653; Tue, 03 Sep 2019 13:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567544388; cv=none; d=google.com; s=arc-20160816; b=Q4uzZVXL0RXCFqcQubsUkixJdkk7mIUxxB/w1NP/J+rn7rwIA4JbbfaBHJKjAAGj4u PJBoAIWBtEbGKw+8MjEYJ4hMs1lvtp4p+O4HjztrST7aBs+wz1XQWEf3TIrO+r97M4FI cSsudueBFS2LOhF8TTZbXIskto9sKreCu7Jt0nFSNyAVYZRg/BzqYT28UMymJRkbDq8f sd+9X9uEYXsQ//BlCYXNgkYQaGCTc2bJxFpvvvQ9n/zqAWN2MDU0Zc6DXhsLC70TNjw5 hoQz4AEbvUrkHaswq/MUeMTu8V1xq14cnWi8pCBGNyKIv/GlcLgqd6hc65MJMer+UHlm lQAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=6624E0hvUY+FlqSvz6Z99/zJCJBK9YhYrGK9b81vrjM=; b=eQ3km5qt2rc7Laxzx6r5p2dOIBQ1WQsyNLSly408iGGrAkLNsdff4xuCgxkWf23See OWhJKpkBs7TcQRtvsf0oCxT2EbCWRYsM4N/Lht1uzdH3M1yNYxlHiP+kOaJwKacliaRT oZcR+haIapnVv6sy/V/WsAaZyM+dHqxY0KBWwA0I456mQxffZNMu6sJwBisVKYhd/v+N AT9mMhZ1yiEB2xPWHeXe4ewx2tLOvrx+g7/dpcd4Byr4ZJPuUbpG69SmYvpWKb+Y8wH4 fyrEAv2YBP6kuCKkE0cbOLmFFDnsXfCY8JuR4WIwT+57iMjjsPWohgrkDJ2qs3kuxhiv RBWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g71si553752pje.17.2019.09.03.13.59.33; Tue, 03 Sep 2019 13:59:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbfICU6m (ORCPT + 99 others); Tue, 3 Sep 2019 16:58:42 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:33806 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1725994AbfICU6m (ORCPT ); Tue, 3 Sep 2019 16:58:42 -0400 Received: (qmail 9141 invoked by uid 2102); 3 Sep 2019 16:58:41 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 3 Sep 2019 16:58:41 -0400 Date: Tue, 3 Sep 2019 16:58:41 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: syzbot cc: Thinh.Nguyen@synopsys.com, , , , , , , , , , , Subject: Re: KASAN: slab-out-of-bounds Read in usb_reset_and_verify_device In-Reply-To: <0000000000007c1f820591ab8105@google.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Sep 2019, syzbot wrote: > Hello, > > syzbot has tested the proposed patch but the reproducer still triggered > crash: > KASAN: slab-out-of-bounds Read in usb_reset_and_verify_device > > usb 4-1: Using ep0 maxpacket: 16 > usb 4-1: Old BOS ffff8881d516b780 Len 0xa8 > usb 4-1: New BOS ffff8881d5dd6d20 Len 0xa8 > ================================================================== > BUG: KASAN: slab-out-of-bounds in memcmp+0xa6/0xb0 lib/string.c:904 > Read of size 1 at addr ffff8881d5dd6db6 by task kworker/0:1/12 More debugging. If my guess is right, this is pretty malicious... Alan Stern #syz test: https://github.com/google/kasan.git eea39f24 drivers/usb/core/config.c | 2 ++ drivers/usb/core/hub.c | 7 +++++++ 2 files changed, 9 insertions(+) Index: usb-devel/drivers/usb/core/hub.c =================================================================== --- usb-devel.orig/drivers/usb/core/hub.c +++ usb-devel/drivers/usb/core/hub.c @@ -5721,6 +5721,13 @@ static int usb_reset_and_verify_device(s if (ret < 0) goto re_enumerate; + if (bos) + dev_info(&udev->dev, "Old BOS %px Len 0x%x\n", + bos, le16_to_cpu(bos->desc->wTotalLength)); + if (udev->bos) + dev_info(&udev->dev, "New BOS %px Len 0x%x\n", + udev->bos, le16_to_cpu(udev->bos->desc->wTotalLength)); + /* Device might have changed firmware (DFU or similar) */ if (descriptors_changed(udev, &descriptor, bos)) { dev_info(&udev->dev, "device firmware changed\n"); Index: usb-devel/drivers/usb/core/config.c =================================================================== --- usb-devel.orig/drivers/usb/core/config.c +++ usb-devel/drivers/usb/core/config.c @@ -966,6 +966,8 @@ int usb_get_bos_descriptor(struct usb_de ret = -ENOMSG; goto err; } + dev_info(ddev, "BOS total length %d, descriptor %d\n", total_len, + le16_to_cpu(dev->bos->desc->wTotalLength)); total_len -= length; for (i = 0; i < num; i++) {