Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5545698ybh; Wed, 7 Aug 2019 07:42:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyD77YinujhGEUbkE3rShwShQgZDa6CvMBlLo0lSfLi7jhVszRbhE/gz8HFfj/AAmJlIbj7 X-Received: by 2002:a17:902:24e:: with SMTP id 72mr8323648plc.65.1565188976577; Wed, 07 Aug 2019 07:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565188976; cv=none; d=google.com; s=arc-20160816; b=xccpZdTt63e1ZClvCvHSRLejhOQPMnjKmvyfKZzkK09pQkNnt8rk3cOcAlTUif69u/ fw1gDFOfdLm/aDjVP0sD9zyRUQlo/LvhcOc90zve2zN52ByBCaGk0k20rZNUsnBCQf8g ZhEhZXIWM5ySnk2qH7ImBQKqdPCaO69K2MnjV4aTFMH516bV2bLrrpfSZSUeeA49iLc5 LarYvRwZ8vXh7EKaiZcxk4cE7T890ozQPxaxqyCoS7Fzl6ZU/rdHpmrOfp3s97Q8S14f HLZp1nHR33FcsIrO+TBo8PshIUFJY2Ag3JTKuNsPR0nzbhYdDk+ATexStjLffjhsCXrP RF9Q== 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=+RX7WUPHrK5zp0iG4sgUaDoVMCVU3yMHfShyIoB5aW8=; b=oQvaiGHbl4WZVQv07Eufs2dn7v1HXSq9lNxIchRLRbYmJgjHrzEOMv2qIqcWRkXcoq QPrhx8sfG5TgwvTRqccL4NwneHtKmrdRAq3HMZRCqei55xClvQPA29aRy3o2Rvo2PYtG 0veDUS1jFrxWIzJNYisohrlumvIR9gZMCbnrhtn/rGksx7dp4yDzeDb2Th+CPIPxOkj1 RtpXUDrro4D4ln3NOKGQpNlX/kchP9VA7mnty7iOStVS8cdMRE7YQX6iv+xTk5tlD3LT nY+52WdXhlholHpdRxARnrE3+luILqGWUFzTrBEzGSvLD3RYia5dyM/g3RCVdGdO/Hxw Ve5g== 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 16si1705812pfc.213.2019.08.07.07.42.41; Wed, 07 Aug 2019 07:42:56 -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 S2388340AbfHGOji (ORCPT + 99 others); Wed, 7 Aug 2019 10:39:38 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:42620 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S2388190AbfHGOjh (ORCPT ); Wed, 7 Aug 2019 10:39:37 -0400 Received: (qmail 18918 invoked by uid 2102); 7 Aug 2019 10:39:36 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 7 Aug 2019 10:39:36 -0400 Date: Wed, 7 Aug 2019 10:39:36 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andrey Konovalov cc: syzbot , Greg Kroah-Hartman , LKML , USB list , Cesar Miquel , , syzkaller-bugs Subject: Re: possible deadlock in open_rio In-Reply-To: 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 Wed, 7 Aug 2019, Andrey Konovalov wrote: > On Wed, Aug 7, 2019 at 4:01 PM Alan Stern wrote: > > > > On Wed, 7 Aug 2019, Andrey Konovalov wrote: > > > > > On Tue, Aug 6, 2019 at 9:13 PM Alan Stern wrote: > > > > > > > > On Thu, 1 Aug 2019, syzbot wrote: > > > > > > > > > Hello, > > > > > > > > > > syzbot found the following crash on: > > > > > > > > > > HEAD commit: 7f7867ff usb-fuzzer: main usb gadget fuzzer driver > > > > > git tree: https://github.com/google/kasan.git usb-fuzzer > > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=136b6aec600000 > > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=792eb47789f57810 > > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=7bbcbe9c9ff0cd49592a > > > > > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > > > > > > > > > > Unfortunately, I don't have any reproducer for this crash yet. > > > > > > > > > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > > > > > Reported-by: syzbot+7bbcbe9c9ff0cd49592a@syzkaller.appspotmail.com > > > > > > > > > > ====================================================== > > > > > WARNING: possible circular locking dependency detected > > > > > 5.3.0-rc2+ #23 Not tainted > > > > > ------------------------------------------------------ > > > > > > > > Andrey: > > > > > > > > This should be completely reproducible, since it's a simple ABBA > > > > locking violation. Maybe just introducing a time delay (to avoid races > > > > and give the open() call time to run) between the gadget creation and > > > > gadget removal would be enough to do it. > > > > > > I've tried some simple approaches to reproducing this, but failed. > > > Should this require two rio500 devices to trigger? > > > > No, one device should be enough. Just plug it in and then try to open > > the character device file. > > OK, I've reproduced it, so I can test a patch manually. The reason > syzbot couldn't do that, is because it doesn't open character devices. > Right now the USB fuzzing instance only opens /dev/input*, > /dev/hidraw* and /dev/usb/hiddev* (only the devices that are created > by USB HID devices as I've been working on adding USB HID targeted > fuzzing support lately). > > I guess we should open /dev/chr/* as well. The problem is that there > 300+ devices there even without connecting USB devices and opening > them blindly probably won't work. Is there a way to know which > character devices are created by USB devices? Maybe they are exposed > over /sys/bus/usb or via some other way? I don't have any devices that use this API, so I can't be certain. However, I believe the devices do get registered under /sys/class/usb/. (Note that this directory doesn't exist when there aren't any USB class files.) In any case, the USB character device files all have their major numbers set to 180 (USB_MAJOR defined in include/linux/usb.h), so you can identify them that way. Alan Stern