Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2713645ybh; Mon, 9 Mar 2020 11:27:48 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt5C1//p/NXgQuf8hLoVYxdppTmYPDK/ddsh+pl3PwwGN9DaMdBdxpIEi+K+XlVstq8uDGu X-Received: by 2002:aca:bfc2:: with SMTP id p185mr3956oif.57.1583778467923; Mon, 09 Mar 2020 11:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583778467; cv=none; d=google.com; s=arc-20160816; b=O7r5bHCsCgVrQI4h+cxAVAgrNhtuBdpouQUMtO81CvGytbyviuL/HKBUyzZxMmfaFo 9VPozuk8Cd4xTyctqcGDv/8Qcm++P/tSUV/DnntroSQZKyEDlVZoNV+UA0e44mXl+A5D AeHld79GKxosyH08AUyCngOn6BbXcCQuaszrFxPm/n5Y4kKXVoOm6WctjJcMGKXhc8dt pZdMPFQ2clV9B8o594VVuSLsl8vV23zSJjBGUB6xPY7VtKE7q9RfUUT0aCG7TBwyoNWR Eb8wA1C2blxtXfeeUQV6p86xdE1zwnlC0zYdoEj7o2V9VcfEHvwHTC6MwkV9QJBF2F+f a6AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=GdJNQzOJFOqKdISqoHHBK9SjrIVmjZPZx9ZPz8U0D/Q=; b=KUmUi6ww8xt0LQylKgCro8unyAnW4jo4kQ11v0ufShAQI8zjfzpKzpwt61eNXDOJCl SolbIEnWN+eQmkhELttHPLY8ZCcqeMK0reIEUiTEteTSt6D/rBLdrGfodyVeKFID7e9O Y04MAqL4EzJGUUKJBzVRBNwTTf/FD4nQ+kGpcjdihqd7lMm9i2fCWMGSFWRy33yoMNC6 fiJh7mxza4oR6cA14Yxdxxpv+7wtzEYQMX6S3mJ1k5sc09am62gWlFDXWfBDDT38XmZ1 bYZL4qYcX3Km0868nebLy5cEMXjM/D/jwbtJUzKD+vqNSV3aZ9Y+yEWowfvhAQvuTniv Tm6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="tx4O/611"; 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 o7si7314948ote.49.2020.03.09.11.27.36; Mon, 09 Mar 2020 11:27:47 -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="tx4O/611"; 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 S1727451AbgCIS1M (ORCPT + 99 others); Mon, 9 Mar 2020 14:27:12 -0400 Received: from mail-wm1-f73.google.com ([209.85.128.73]:50398 "EHLO mail-wm1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727350AbgCIS1M (ORCPT ); Mon, 9 Mar 2020 14:27:12 -0400 Received: by mail-wm1-f73.google.com with SMTP id p186so179257wmp.0 for ; Mon, 09 Mar 2020 11:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=GdJNQzOJFOqKdISqoHHBK9SjrIVmjZPZx9ZPz8U0D/Q=; b=tx4O/611hF+ZbF+8vaJD7WcRX5OInMP1WOHxCQKUTa3W3rIUCRRa0Pzbr2+XXke4id 5pD1evIXnvUfJCRQ4zZRPlUQrDTBGifP7DgXKYQ3Xr3ykk4OFLIswSR8dh27YXgoZyCs DSYuLjTZ19uExvo6oR6613S3ecWt2O3GfpS4SenptNGaGjDx9K8a+HlI2DPoaXUCVPLl 3NYtdjengW8w0REmafpeMt+Qvvbgfo85IXnOV1QeKWOwiNWBnbq/2yqY7yNiQ1XuQFcx Z2XLT+PVGoezeoLE7YBEHdzmh9liPSInWDvD+3EvfyuhJ6IeGb7AhroMscta9qfmBAzP bPiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=GdJNQzOJFOqKdISqoHHBK9SjrIVmjZPZx9ZPz8U0D/Q=; b=X1PUaZksauDkrQFJxV1MkRdYn6CT6eyRKCsFKFM+p9A9s+aTqnenGxNs+SqLmPAmwv Qyh5MB9EPMocNudISQLRcUpmxCHsUe8Yxmk5vQlZAg0rmRZtFPNhusLxFrzK5b4KYQ0n ISNYdHrHPxua2Sq8tMANgMbZtu6esBhKW2AcT0Bh8LPnbPgeq6FAOuGf4WTM2pBd2aiF mowynIHoAsyO3Ty6QZKvEFPhCh5UmA0+p/Bu5Q4f4l1pMMEHVtZafdBje2hMv6JFzct3 LeM0KIvh2RJMKlu0lTSWiKph1VzgH+Op2BeL7H+sSQiUPsFh3espznBIxgCY8y8QPFrs XJSQ== X-Gm-Message-State: ANhLgQ0Mjekc9ilM6pDpXM49J7MxqLS04Q/gYu+QYFN65gyiyY1Ujk4k duzBOAYxYXjOY5jhVzW988N55KXZYs4zqdjp X-Received: by 2002:adf:ea42:: with SMTP id j2mr21611992wrn.377.1583778429837; Mon, 09 Mar 2020 11:27:09 -0700 (PDT) Date: Mon, 9 Mar 2020 19:27:03 +0100 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog Subject: [PATCH v2 0/3] kcov: collect coverage from usb soft interrupts From: Andrey Konovalov To: Dmitry Vyukov Cc: Greg Kroah-Hartman , Alan Stern , Andrew Morton , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Potapenko , Marco Elver , Andrey Konovalov 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 This patchset extends kcov to allow collecting coverage from soft interrupts and then uses the new functionality to collect coverage from USB code. This has allowed to find at least one new HID bug [1], which was recently fixed by Alan [2]. [1] https://syzkaller.appspot.com/bug?extid=09ef48aa58261464b621 [2] https://patchwork.kernel.org/patch/11283319/ Any subsystem that uses softirqs (e.g. timers) can make use of this in the future. Looking at the recent syzbot reports, an obvious candidate is the networking subsystem [3, 4, 5 and many more]. [3] https://syzkaller.appspot.com/bug?extid=522ab502c69badc66ab7 [4] https://syzkaller.appspot.com/bug?extid=57f89d05946c53dbbb31 [5] https://syzkaller.appspot.com/bug?extid=df358e65d9c1b9d3f5f4 This patchset has been pushed to the public Linux kernel Gerrit instance: https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/2225 Changes v1 -> v2: - Add local_irq_save/restore() critical sections to simplify dealing with softirqs happening during kcov_remote_start/stop(). - Set kcov_softirq after flag kcov_start() in kcov_remote_start(). Changes RFC -> v1: - Don't support hardirq or nmi, only softirq, to avoid issues with nested interrupts. - Combined multiple per-cpu variables into one. - Used plain accesses and kcov_start/stop() instead of xchg()'s. - Simplified handling of per-cpu variables. - Avoid disabling interrupts for the whole kcov_remote_start/stop() region. - Avoid overwriting t->kcov_sequence when saving/restoring state. - Move kcov_remote_start/stop_usb() annotations into __usb_hcd_giveback_urb() to cover all urb complete() callbacks at once. - Drop unneeded Dummy HCD changes. - Split out a patch that removed debug messages. Signed-off-by: Andrey Konovalov Andrey Konovalov (3): kcov: cleanup debug messages kcov: collect coverage from interrupts usb: core: kcov: collect coverage from usb complete callback Documentation/dev-tools/kcov.rst | 17 +-- drivers/usb/core/hcd.c | 3 + include/linux/sched.h | 3 + kernel/kcov.c | 221 +++++++++++++++++++++---------- lib/Kconfig.debug | 9 ++ 5 files changed, 178 insertions(+), 75 deletions(-) -- 2.25.1.481.gfbce0eb801-goog