Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp449796pxu; Tue, 5 Jan 2021 16:13:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPBuLSM6RAF4hz/J8acVtt5KWiAkosm09i2kp1h+x8I4vzB5FFuiiMDcJfUcfjqUNKg9v6 X-Received: by 2002:a05:6402:1816:: with SMTP id g22mr2227000edy.80.1609891979950; Tue, 05 Jan 2021 16:12:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609891979; cv=none; d=google.com; s=arc-20160816; b=FnimYwpxIAxX1Js28U3wO0gPZT5v8eWTwFPDnmQpniGdWxlKDW3gA4+oGwGWl4K2HQ P5YfwvHCcShSPXlsiVoxczj2SVEQHU9tRrmiyP7oVqzUQhAPt/vGgmjeh8+huegwIRN1 edbPixWBdeNiYMejzECDlu4izKZ4yVGLPqqsPt+5APNfNxD8qh8E0TYke+NlowlEOrnu k3jFTakKT6fV+tAwN+MxTocBTjkAU07UB44CAFlpD9tz3VvijvMFy/DYWauD9yG1seJC dpz4IQapnO/pzxy/Hd30+2qk8GX26ZgDnkZNy8Z8kLgBB83pRTN4XTzIW7SpAjqEmb8K N/3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SYP7m953Sh1/b2c2QWHDIe0Jh5wcwMv/xNkLawK3758=; b=h0ccABkRidN9LZ1VflleMi+8vhfpLCWVarpfuCG6W0GZDxlW5d9vzj+SQiZOOsPV+X vzHcwxzTWFHeZ3nT49NfXRDghh6sAnsMzg4C+S19zNorPRuMGVj0zppWN0otqDNcAlw6 Sn7Pu4uEE5dqvIbLQsYY9kuYuujZoU82+2OZdDgr1a/np4MrmnbxOGNdiBu0s0HLHkoa foPrhycvBW9yIbWlcizr1MWB/y+MjjCGDoUe7/y4wasaK167HncOcKNSibfIxUUZMTqW mDXP5255JX6T71r4PFG+zGUbgwTA8T/y/ypZuVu/hgjDVd3VuG+kftrr66VfeEDskXFc BJvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=eh1wDbOj; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si278194edb.68.2021.01.05.16.12.36; Tue, 05 Jan 2021 16:12:59 -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=@google.com header.s=20161025 header.b=eh1wDbOj; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731058AbhAETs1 (ORCPT + 99 others); Tue, 5 Jan 2021 14:48:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731053AbhAETs0 (ORCPT ); Tue, 5 Jan 2021 14:48:26 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B3E6C061798 for ; Tue, 5 Jan 2021 11:47:46 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id s21so324875pfu.13 for ; Tue, 05 Jan 2021 11:47:46 -0800 (PST) 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=SYP7m953Sh1/b2c2QWHDIe0Jh5wcwMv/xNkLawK3758=; b=eh1wDbOjV5w7hs1P4onKpIUp9lE3rC9aYw93OThl4XBTbR//RXNgg1ddZHGUSJM+l8 j5z6U3q4ZKBwpQCBQXtzZFNt8SFT3XJrsxxOIYVM9kiZ2bgTxgYJFtlm06WRzD2M5fPx unQkftE/IrnlHmk5qC4//Rf4LFireHYdA+aUFhjMTCK6iv05qt/2++Oq+dah0KOPJACU rJBNpSf7hoJ69FbDvgjQXRAJEPxh2TfzU4vf253RiLpb7Jx9RteITtpHQVdc59raQGwN Nhrbqb75pWi5SgDvRkGGnI5B8L/8PzAnOMcqJaUxDYkYKu2X+VVvIq3oIAx5odeCx7ro a+JQ== 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=SYP7m953Sh1/b2c2QWHDIe0Jh5wcwMv/xNkLawK3758=; b=HIQvnKt4L8Pghd+yzzo6gaUaho0IXQO2RUBKEPHfM8CFU1aIwQf6hZmBzmnrlLrPOL KB2UW9o+IqxDSeTRcBJbpS/2fERoa8mtdOOnzGWcy2evvXqz2GntCjdwiLHbhc0Pcqvs gKYGd/7PlF0VXiNoeFMYq4xUmDXBHZdXYwQnmD8K67xpfVGwrcZgIXHNcYa0x59ixDX8 c6mMLiu4xhJAquXGYK3ah5zOHfA+QoqC3MKfp6Lk6WqgdXyq1D4f98KkZbBa0lffGM6G NwdhZLnFCBvG7FzVH5FuqzqWdBVZwSKRhHSgmtHl3ni3IbBpm13VHkdILtgLiI4OiaKs Blsg== X-Gm-Message-State: AOAM532DHAeDdWtEtbuPoZQ52U+T1u6C2sviJmyA0+bAqfdWJjGEJab+ B1Sw+luRhzAi2NHLT8hx255qnwP4VRYltPAqVdVT6A== X-Received: by 2002:a63:4644:: with SMTP id v4mr851869pgk.440.1609876065848; Tue, 05 Jan 2021 11:47:45 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Tue, 5 Jan 2021 20:47:35 +0100 Message-ID: Subject: Re: [PATCH v5] kcov, usb: only collect coverage from __usb_hcd_giveback_urb in softirq To: Greg Kroah-Hartman Cc: USB list , LKML , kasan-dev , Dmitry Vyukov , Shuah Khan , Alexander Potapenko , Marco Elver , Nazime Hande Harputluoglu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 28, 2020 at 3:51 PM Greg Kroah-Hartman wrote: > > 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 :( Hm, I see version 4 in 5.11-rc1. Let me send a fix up.