Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3388507pxk; Mon, 5 Oct 2020 08:28:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdM6Pet6SX4q9yr7piXcMjcKrTubsLius9ZYlNPDvSMi7cM6sYKi4tOmW+qQuxV80a0gyU X-Received: by 2002:a17:906:a198:: with SMTP id s24mr284787ejy.154.1601911726803; Mon, 05 Oct 2020 08:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601911726; cv=none; d=google.com; s=arc-20160816; b=qVM1OjFc6SM86Fv0j+iIn5+BbDcisFN9YfcI/7dolBJnRZPZx448hU8Kc0AOKfozHS Q0eYrYMFTDL9x9dz0edBdGym0bi4vEVZhmg/9qAtOnZZrr1zrUdqq2almV/QvbZcW5ar lVS7veo1U76OtQs6XfG2rBVWItvHg7oSWlYNwYy9Nb8ZT7mrK8dTQaALISc6+M3qCeFc 4iLou74Jl7yZoWQ7zb+FiEo+yd9RswluidOIfOrHgkaq9XlulGStnCK48QQLsdrqFj8t aOIlfHMZkDnzbUWFoBoKaYnb7J7y9Uk/lfsXEXo58zWkR8sV+dfwPW0UHn0cwP7XlakO KYRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=tcuLIlclznheuVooolBCltVxW9w8Y49dJk5FiApFkio=; b=Twftfh2jKTXDOLiYb/4l5GI5CtKPGMMLqnV5fx85xm1PVnO0eTPQ6oFowXl44+xSj2 jr6hFF4a7qqMj1MeNFcs8OFA2mYyQmiRIE2Yw/Kq7s8IxV3hc6gF0LNV7kRnLeAMkgIf Nh8Ao7qcwLVZ0lau/FTbtKM021QZIwjZojECqh17EceeYS/sG09xA4l5YfTxsSNqjga/ XHxG1T6cyfTTx/wKUCcmyERLyj4xiHzy7ASOkN5wbSKE/fwFNzLQwQ4AK8hpuRE01H7f 6UEuE5N8MT/FhT1mgJZy/ONLXqc7VDfmgN8fOYX2y7Si3BKCEzkAtxNyiESNwfakNHnH LcIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si195586edv.144.2020.10.05.08.28.23; Mon, 05 Oct 2020 08:28:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727048AbgJEPZp (ORCPT + 99 others); Mon, 5 Oct 2020 11:25:45 -0400 Received: from netrider.rowland.org ([192.131.102.5]:42135 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727032AbgJEPZl (ORCPT ); Mon, 5 Oct 2020 11:25:41 -0400 Received: (qmail 380341 invoked by uid 1000); 5 Oct 2020 11:25:40 -0400 Date: Mon, 5 Oct 2020 11:25:40 -0400 From: Alan Stern To: Andrey Konovalov Cc: Greg Kroah-Hartman , Valentina Manea , Shuah Khan , USB list , LKML , Dmitry Vyukov , Nazime Hande Harputluoglu , syzkaller Subject: Re: Is usb_hcd_giveback_urb() allowed in task context? Message-ID: <20201005152540.GG376584@rowland.harvard.edu> References: <20201005151857.GA2309511@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 05, 2020 at 05:21:30PM +0200, Andrey Konovalov wrote: > On Mon, Oct 5, 2020 at 5:18 PM Greg Kroah-Hartman > wrote: > > > > On Mon, Oct 05, 2020 at 05:08:11PM +0200, Andrey Konovalov wrote: > > > Dear USB and USB/IP maintainers, > > > > > > While fuzzing the USB/IP stack with syzkaller we've stumbled upon an issue. > > > > > > Currently kcov (the subsystem that is used for coverage collection) > > > USB-related callbacks assume that usb_hcd_giveback_urb() can only be > > > called from interrupt context, as indicated by the comment before the > > > function definition. In the USB/IP code, however, it's called from the > > > task context (see the stack trace below). > > > > > > Is this something that is allowed and we need to fix kcov? Or is this > > > a bug in USB/IP? > > > > It's a bug in kcov, and is not true as you have found out :) > > OK, I see, I'll work on a fix, thanks! > > Should I also update the comment above usb_hcd_giveback_urb() to > mention that it can be called in_task()? Or is this redundant and is > assumed in general? No, no -- it won't work right if it's called in process context. Not only do the spinlock calls leave the interrupt flag unchanged, also the driver callback routines may expect to be invoked with interrupts disabled. (We have tried to fix this, but I'm not at all certain that all the cases have been updated.) Alan Stern