Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3543720yba; Tue, 23 Apr 2019 05:47:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzROc3smCW+Xn4g6HhDbt9jTxih3lKeww0o2Arz1j/PrZxpXzA1lHB0+OthzQlynp/zjZGj X-Received: by 2002:aa7:8ac8:: with SMTP id b8mr26347419pfd.234.1556023650133; Tue, 23 Apr 2019 05:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556023650; cv=none; d=google.com; s=arc-20160816; b=ejWWzgftfi/AxnplailWBwrKv3aq/xUXWgGy3TUEI20N0La7qGN1ysH4UFZ9WLDp66 6Xl0O1GSWNOExyCeBlv1/Pn95XjRBhRL33cVq6grA4ySLXsYoMShcLSDd/gcMpFQk5pL 4X0QlZxxT70rUaNc0jUswE5nqsQ5epjAzpzIk9mvMEQd0xWbi2gPJTtZeUgiLMET+TM/ xXayOmqyH5BOJU45n06EP66954qk7cUwetoVRV16jgX2rpgvc6g+IU7dFILGjAdLff6Z th4smlOEA4lDbTXcUosM6yPn/s7x/gVyZAtl5GJ1CxdPOVsew7Op8jOBvUIEPofdl7uA 619Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=drP+3jXgBFG4XDNGP4blkFr7mTMqlSYTTt2HSdhDEPg=; b=U6KRfRJs2aUHp+6TDuDppZ2Z1+hWiiZZttGhGyvi39Mm0NyFT1s7t8IHzkeLVc1W1c FRuq+VE0g2FGgMTn7vb0CqEIXzZvEyuoqZ6uSt9i1QnNZm2AthGU9gWCX0UlxjblykW4 2Sum9cBqudwTGirQI7np5g5coIHgEGzWUEMBObpdk3Za/IAhq/qYScBIzFojRd1MYZvK w8U+JHf9JWqvf2iHTqv/aeWSPTPM+9xxUxU9oE2PpanVnLVZVPOQetI/UcIli/ujnKIk hq1KNW23igVo8E5BKIJ0B4Yk3dpOb6X872Fhmev8jRBCvkeXwN31o6dQhVE10IlFbCTm 0Asw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qJn9kQES; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x30si15443260pgl.477.2019.04.23.05.47.13; Tue, 23 Apr 2019 05:47:30 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=qJn9kQES; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727695AbfDWMpF (ORCPT + 99 others); Tue, 23 Apr 2019 08:45:05 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:40139 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727228AbfDWMpF (ORCPT ); Tue, 23 Apr 2019 08:45:05 -0400 Received: by mail-pl1-f196.google.com with SMTP id b3so7483494plr.7 for ; Tue, 23 Apr 2019 05:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=drP+3jXgBFG4XDNGP4blkFr7mTMqlSYTTt2HSdhDEPg=; b=qJn9kQES2XCFX4FUrxy3jQm2W9Y0FNjYQBCq7a6EGeb/Hx/VQK3MBTpYlnV8eeUKNN r7b0XhkXFd9D/gZVVxjHHdrkW6V0PURsHbFw8lZuG2O6G+RhUjfXLJZW/PjEwt3UQZ4w A5Cbc8RjaD65sgstQ8UR+ZHW28iK/3bz+7aoOV3VszQCxTQnbOjs6+FUvmlZtlDXc++q OhXF3w+84oUGwYbgwGH9+0uyCS9OHdt+iNom2Bd1Gsbhwnpnh/IM9SxYPOkrwgGJL1Ho ahhd2ewaqe/GfkSxkPb7kPFWYPV71xGcUHAXhxkn+LLo4UpSlDoQYTmcCAAuAuJuaEul HEqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=drP+3jXgBFG4XDNGP4blkFr7mTMqlSYTTt2HSdhDEPg=; b=uYwmurH4OA2e0g+E2zosWlLWwXu+SSb5AF+FuBn8ZSqarg8boWnVY/eAVGf5vYb06n TmJutTrQJO3KLwOyj8jgP3Rs7RtzqRK62MvBW/K6f0L9nwYuFY6ar7A8Te9193hWY+PU PDVQMnXgf6qkGyNVt0yoiRux6pL8JuwVvDrFme3tYS2uqDnbUVC3/Y9mt9sBymS81/3E zXkDnkkD8OqfK0mJvGkpmess2qKbIe7O4VbkevdJ5CkaNf5VNa3nXMlnCgvBaoUIAEyq G06OFLMFVFCOFwcM6E8Ffh+pJcMudQL730+V/Lj6Bjw5KhQsckV/eyp6J+y6WwLELvSB JYQw== X-Gm-Message-State: APjAAAVxAN3+MV9MVLMBUiHHZ8OxIb9xR2obhk3621E9CGjhVEybRYja ewyz6ZyKKr1hvlCY8Es/A+XqnbRdAYmmbfAC0tJTxg== X-Received: by 2002:a17:902:2b89:: with SMTP id l9mr24732595plb.329.1556023503064; Tue, 23 Apr 2019 05:45:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Tue, 23 Apr 2019 14:44:51 +0200 Message-ID: Subject: Re: UDC hardware for fuzzing [was: Re: INFO: task hung in usb_kill_urb] To: Alan Stern Cc: Felipe Balbi , Greg Kroah-Hartman , "Gustavo A. R. Silva" , LKML , syzkaller-bugs , USB list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 19, 2019 at 8:36 PM Alan Stern wrote: > > On Wed, 17 Apr 2019, Andrey Konovalov wrote: > > > On Tue, Apr 16, 2019 at 8:25 PM Alan Stern wrote: > > > > > > On Tue, 16 Apr 2019, syzbot wrote: > > > > > > > Hello, > > > > > > > > syzbot has tested the proposed patch but the reproducer still triggered > > > > crash: > > > > INFO: task hung in usb_kill_urb > > > > > > Okay, I think I found the problem. dummy-hcd doesn't check for > > > unsupported speeds until it is too late. Andrey, what values does your > > > usb-fuzzer gadget driver set for its max_speed field? > > > > It's passed from userspace without any validation :( I'll fix this! > > Thanks for looking into it! > > > > I wonder why other people saw this hang as well, they didn't use the > > dummy hcd module for sure. I guess there are might be other reasons. > > Unquestionably it would be for other reasons. usb_kill_urb() is a > host-side routine, not used by gadget drivers. If it fails, the reason > lies in host controller driver. And if people aren't using dummy-hcd > then they must be using a different host controller driver. > > Is there any chance you could get hold of a USB device controller for > more fuzzing tests? With it, you could test other parts of the USB > stack: the UDC driver for whatever hardware you get, and the host > controller driver for whatever you plug the UDC into. > > I don't know what types of UDC are readily available for the type of > computer syzkaller uses. Perhaps Felipe or other people on the mailing > list will have some suggestions. You mean using a hardware UDC and plugging it into a USB host via a physical USB cable? Yeah, I've tried that. I've used the UDC that's available on Raspberry Pi Zero which uses the dwc2 driver for running the reproducers syzkaller generates while having it connected to a Linux host. It works! =) I also have a USB3380 based UDC that uses the net2280 gadget driver. It kind of works, I was able to emulate a SuperSpeed device with it, but the driver crashes all the time. I haven't tried actual fuzzing of a physical host yet, that is something on my TODO list. I was more interested in fuzzing non-Linux hosts this way, but I can try it with Linux as well. The problem here is that it's difficult to automate this.