Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9110053pxu; Mon, 28 Dec 2020 06:54:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwo/bFVIVd47SYpy6mBVURRZ/9dp4fpjms0xH4lB3CrH5YpX+UgvdWPKfImEDx5ODT0Bp3U X-Received: by 2002:a17:907:40f0:: with SMTP id nn24mr41280191ejb.233.1609167269657; Mon, 28 Dec 2020 06:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167269; cv=none; d=google.com; s=arc-20160816; b=optmIZax34U9JHEcr5dyNm4p6Fsoc/6pCh1NBHA7KMht6pws+bkl82mbGAOVmccXvN iTGfmpkTBKKQPy7LNXBh1Xa92AAuriTF/pY3M0VHGdilJ+Qy1eA+lPlTvtybyzpLTD4h u139RUBlWxQh/7ExgGCusTMuwpYVoY6y0r9kbfu1w3IvO0X2U5Jr9RhEf+57kcJu7KOH uL5N+EJ9a79lnah5wpY56hOu6h5vIUrPBCQqSGW6LAv6krFngUW5QMF9TbxasMaB3+4f 1FszCI46HFqiNrc9fg8kyC1L/Fk2lPw1NQgF2f9t7E5cQbKfyL91TcIx/ktXJ3SIOvTu aeOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LB6uN59veMk5B3hXDCpU0vfNuHyBgurllHRfzz0zR/M=; b=grorbebUHBpYN7WRZt8lh2/yxax9aNY8EO7Nx9X9NxCmi2TEMQDHLTvXZUv7x9ROn+ S5jZ77nzlH168gGeackcNCR9Vl2qEVhEjZ+XKwCti0yzOyDr1SVamz+bvZ7RXv7Yunni i2L925+Kx3S+rdra/LrVt1g/CX8M4oOk4NXDLYk8jcR9hsiDfEd8MN8H6ptTXrKpTlIi U+wLL8OTF5GBNDL85z62/E8dHm66ZPKh3G9cra2RQlQg9fmO0q9VlL0tk7GkqX6souGx nzr1nqtN4rGIUDRc41eA/4AGhYHgFK4Z0rd8bwCVru5kZha81+PbgrxOuTaKfICHEUyc V5TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AUMwak0p; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 61si6410034edf.562.2020.12.28.06.54.06; Mon, 28 Dec 2020 06:54:29 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AUMwak0p; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505364AbgL1OwK (ORCPT + 99 others); Mon, 28 Dec 2020 09:52:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:51092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbgL1OwI (ORCPT ); Mon, 28 Dec 2020 09:52:08 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B4B2A2084D; Mon, 28 Dec 2020 14:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609167088; bh=odTKooUE1YbyrBjjpDjD4r0zjZEcvPiR1tfvSqIE2UY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AUMwak0p6vcVE1k3Gz6DJgbtEKg4wrXpTqFBHcXTndBMiMNhF/lkleEM+pCEezohe nqUKEhtrJXzNXIm/ovexKsqjm2IiHWaIK/6D+LqJ6AACWRxcSMuIdhcjaPe07sFcgi JGgX8wB8yt+rwyiIOFCLmQAtZVWaYnQ9PyY7AVRk= Date: Mon, 28 Dec 2020 15:52:50 +0100 From: Greg Kroah-Hartman To: Andrey Konovalov Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Dmitry Vyukov , Shuah Khan , Alexander Potapenko , Marco Elver , Nazime Hande Harputluoglu Subject: Re: [PATCH v5] kcov, usb: only collect coverage from __usb_hcd_giveback_urb in softirq Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 24, 2020 at 12:47:25AM +0100, Andrey Konovalov wrote: > Currently there's a kcov remote coverage collection section in > __usb_hcd_giveback_urb(). Initially that section was added based on the > assumption that usb_hcd_giveback_urb() can only be called in interrupt > context as indicated by a comment before it. This is what happens when > syzkaller is fuzzing the USB stack via the dummy_hcd driver. > > As it turns out, it's actually valid to call usb_hcd_giveback_urb() in task > context, provided that the caller turned off the interrupts; USB/IP does > exactly that. This can lead to a nested KCOV remote coverage collection > sections both trying to collect coverage in task context. This isn't > supported by kcov, and leads to a WARNING. > > Change __usb_hcd_giveback_urb() to only call kcov_remote_*() callbacks > when it's being executed in a softirq. To avoid calling > in_serving_softirq() directly in the driver code, add a couple of new kcov > wrappers. > > As the result of this change, the coverage from USB/IP related > usb_hcd_giveback_urb() calls won't be collected, but the WARNING is fixed. > > A potential future improvement would be to support nested remote coverage > collection sections, but this patch doesn't address that. > > Signed-off-by: Andrey Konovalov > Acked-by: Marco Elver > --- > > Changes in v5: > - Don't call in_serving_softirq() in USB driver code directly, do that > via kcov wrappers. Does not apply to 5.11-rc1 :(