From nobody Thu Feb 12 15:44:51 2026 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8610173324 for ; Tue, 11 Jun 2024 07:50:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092248; cv=none; b=OKEdSrGWQZbJVkibwaSJxsomP8Wv/qmgZ5RanmcyP4oW6zUZBpWs7RNHkhUzvSwhSG8z3YCpiAs3g2UCrUD3285AntyyT/5ah7It+6eetEYcqMCWPTuN2phuPQzHWBiMD9JdVCBpunlaUbS/2imll3ynzcnbYYOsXUdAU9yxKHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092248; c=relaxed/simple; bh=7WFTaoPd6g0ZpYQbP4UGUhGjBxvqWVx9Cf/jADBYR7I=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=TMAkOiFProJyc5OBq4bONjVR7R6gqFXnzEySBMLh1rOsXDXLnIwqzVN+ecC5abi9H03xRGcPsVqx2cI04gXiDEpEDqYh2gaVRYaptn1yMwXoV5U/aZ8aeL2GJ8AoQpo9Z6Exf2cJIwKygTn0RIO9rCgi8EVlPBg5sZHRqFLiDVI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dvyukov.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CaZluKs4; arc=none smtp.client-ip=209.85.208.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dvyukov.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CaZluKs4" Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-57a306c4b1eso3701163a12.0 for ; Tue, 11 Jun 2024 00:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718092245; x=1718697045; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=vwuQA0p0+HG46lx6pF3ZZS+XaAeBpStGoMIngkuSx9c=; b=CaZluKs4A8t9ntBtZoNUTT5QOLc2OU+a2OsairG4ExWKPi3jb3fouovASiIWy1j7HF fdn0GImRyVQ/bOgSv/WiMoC+WsIt8iON35tQJgtJtw/btgKzRcAYCTgvLs7MiyAQ3UQX Zt2RRl4/sS4gC1MqddLAuRhj5ZlPNe0TQhC1KHR5KOIMVgVmr5WUSB6nGvnH5T9f0ACk eRX11VrsOu9oMJ0Yi2x0LEUXtLdJQo5fpBx3umGfO8k7AZcoF3oGZ5YoG0z1xrGISVjP 6j1Yq3204ifXENo1eEpl2Zav2UOgzoCu5UFJTLOKH3XfWJNpL9RZuyiF5bl+UFnblPpu P2pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718092245; x=1718697045; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vwuQA0p0+HG46lx6pF3ZZS+XaAeBpStGoMIngkuSx9c=; b=aQlPuzCtb3UBQ+pYzYwXoPnhXXNDgNhMmgjXHI1i+NbVcgp2cp0DmlMoBtCyMNaAwg W4Xw1GN09l0gR/YXWCXrQyQ5p2q083lmS+Fgqo/qtKPji29REdboyr+d6yTeWNyUFyo5 VJh6D6UGrAGrraG/ULK6h/l43pfMe6U35BnLTKu09JJz7pKI947daUrmiVxhlraJv0td VnGvMx1Hsk+XR+RbleAIhP19GAm4Q+uX7laYpW4ykkikNDSGmi3zexm+zx4aFU7MtTOL xjrYCHSKl4sUicPYIuFYZIyaHQWS5QOOxcMPLbfh1fQQFGz4TiFcuLUngW53mT0XUk3u 2fLw== X-Gm-Message-State: AOJu0YyO2+V+RJ49GrjUP5xNn9y8lCkUEw4YReWLJuXXsTRsod0duYlk KA6mnXwxkoQnpaQ7sXcFyubFIt/BRiTL6lVDn3DGzvU4QI75UBmb8w+/MrrA6T/ZLS+uKUs0tNu 3Qe4kVw== X-Google-Smtp-Source: AGHT+IEfApTwOGG3l/6rsfCwCSPsaLFJ3yD1+iIRVS72JUcJsFxfC5+Ok6FlJY/rf3pz2IQmxfsVY25piVL1 X-Received: from dvyukov-desk.muc.corp.google.com ([2a00:79e0:9c:201:ecf:76a8:5d44:6e8b]) (user=dvyukov job=sendgmr) by 2002:a05:6402:3809:b0:57c:82b2:8699 with SMTP id 4fb4d7f45d1cf-57c82b28836mr6596a12.6.1718092243480; Tue, 11 Jun 2024 00:50:43 -0700 (PDT) Date: Tue, 11 Jun 2024 09:50:30 +0200 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <3f9a1de9e415fcb53d07dc9e19fa8481bb021b1b.1718092070.git.dvyukov@google.com> Subject: [PATCH v2 1/4] x86/entry: Remove unwanted instrumentation in common_interrupt() From: Dmitry Vyukov To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org Cc: linux-kernel@vger.kernel.org, syzkaller@googlegroups.com, elver@google.com, glider@google.com, nogikh@google.com, tarasmadan@google.com, Dmitry Vyukov Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" common_interrupt() and friends call kvm_set_cpu_l1tf_flush_l1d(), which is not marked as noinstr nor __always_inline. So compiler outlines it and adds instrumentation to it. Since the call is inside of instrumentation_begin/end(), objtool does not warn about it. The manifestation is that KCOV produces spurious coverage in kvm_set_cpu_l1tf_flush_l1d() in random places because the call happens when preempt count is not yet updated to say that we are in an interrupt. Mark kvm_set_cpu_l1tf_flush_l1d() as __always_inline and move out of instrumentation_begin/end() section. It only calls __this_cpu_write() which is already safe to call in noinstr contexts. Signed-off-by: Dmitry Vyukov Reviewed-by: Alexander Potapenko Fixes: 6368558c3710 ("x86/entry: Provide IDTENTRY_SYSVEC") Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: syzkaller@googlegroups.com Acked-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/hardirq.h | 8 ++++++-- arch/x86/include/asm/idtentry.h | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h index c67fa6ad098a..6ffa8b75f4cd 100644 --- a/arch/x86/include/asm/hardirq.h +++ b/arch/x86/include/asm/hardirq.h @@ -69,7 +69,11 @@ extern u64 arch_irq_stat(void); #define local_softirq_pending_ref pcpu_hot.softirq_pending =20 #if IS_ENABLED(CONFIG_KVM_INTEL) -static inline void kvm_set_cpu_l1tf_flush_l1d(void) +/* + * This function is called from noinstr interrupt contexts + * and must be inlined to not get instrumentation. + */ +static __always_inline void kvm_set_cpu_l1tf_flush_l1d(void) { __this_cpu_write(irq_stat.kvm_cpu_l1tf_flush_l1d, 1); } @@ -84,7 +88,7 @@ static __always_inline bool kvm_get_cpu_l1tf_flush_l1d(vo= id) return __this_cpu_read(irq_stat.kvm_cpu_l1tf_flush_l1d); } #else /* !IS_ENABLED(CONFIG_KVM_INTEL) */ -static inline void kvm_set_cpu_l1tf_flush_l1d(void) { } +static __always_inline void kvm_set_cpu_l1tf_flush_l1d(void) { } #endif /* IS_ENABLED(CONFIG_KVM_INTEL) */ =20 #endif /* _ASM_X86_HARDIRQ_H */ diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentr= y.h index d4f24499b256..ad5c68f0509d 100644 --- a/arch/x86/include/asm/idtentry.h +++ b/arch/x86/include/asm/idtentry.h @@ -212,8 +212,8 @@ __visible noinstr void func(struct pt_regs *regs, \ irqentry_state_t state =3D irqentry_enter(regs); \ u32 vector =3D (u32)(u8)error_code; \ \ + kvm_set_cpu_l1tf_flush_l1d(); \ instrumentation_begin(); \ - kvm_set_cpu_l1tf_flush_l1d(); \ run_irq_on_irqstack_cond(__##func, regs, vector); \ instrumentation_end(); \ irqentry_exit(regs, state); \ @@ -250,7 +250,6 @@ static void __##func(struct pt_regs *regs); \ \ static __always_inline void instr_##func(struct pt_regs *regs) \ { \ - kvm_set_cpu_l1tf_flush_l1d(); \ run_sysvec_on_irqstack_cond(__##func, regs); \ } \ \ @@ -258,6 +257,7 @@ __visible noinstr void func(struct pt_regs *regs) \ { \ irqentry_state_t state =3D irqentry_enter(regs); \ \ + kvm_set_cpu_l1tf_flush_l1d(); \ instrumentation_begin(); \ instr_##func (regs); \ instrumentation_end(); \ @@ -288,7 +288,6 @@ static __always_inline void __##func(struct pt_regs *re= gs); \ static __always_inline void instr_##func(struct pt_regs *regs) \ { \ __irq_enter_raw(); \ - kvm_set_cpu_l1tf_flush_l1d(); \ __##func (regs); \ __irq_exit_raw(); \ } \ @@ -297,6 +296,7 @@ __visible noinstr void func(struct pt_regs *regs) \ { \ irqentry_state_t state =3D irqentry_enter(regs); \ \ + kvm_set_cpu_l1tf_flush_l1d(); \ instrumentation_begin(); \ instr_##func (regs); \ instrumentation_end(); \ --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 15:44:51 2026 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E07417333C for ; Tue, 11 Jun 2024 07:50:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092251; cv=none; b=Ddc8rfo4GOfcIVLDS5ohRfB/E/YeYWwszW/qw8BKBRJJtkggInMivkceGj1+GJOKRr2A/60iZ3c0av1ePnHqNhywUnF/DEpMzB9qk3c73o6WpXmo3SdDh8KbLKNavc6NwS6xKmXGNJxqQfCL3w6QuBz0Ka0GuWhcsZ+yCAV6xsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092251; c=relaxed/simple; bh=obXNaQKtwmfKs/HeVx3sFOvUFRiQ9zUGMKMIURRICfM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Y2XuexzOZPMHTHhcaJXJvbyEs8FdFOQWNe/NgSmwqDmuXfv5a0/r/OA4/LVjfZSQS+6jWwbHZG2drUnsT1ESE4RkpKa9dDOuznS488fWqHn3Qzg4xlRUmzY1g9RglpBrYPzwgIjqYBnAR3Fi80+OowiPGJsay0BkEKIsTlb61m8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dvyukov.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uooPEM6J; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dvyukov.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uooPEM6J" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dfb17fb0fb6so4905652276.1 for ; Tue, 11 Jun 2024 00:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718092248; x=1718697048; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=UAtcOHuRzSGyLislV7ie7CX+oVaiZiFwLMGIqPD6yUY=; b=uooPEM6JEKV0TGjRgjiC/worVz9Od5Nu9q+Wy1YKEV3rtjiUpKhneMZNYTsADg0e3B jIXQIUoLnPm1nHjTfNH24VSy5qwNh5cMMUSELoFId7w3e79rvoj73lomVZs1AE0nHlX+ Echx6Z8f1wSqjEIWlekGyeSPvZ4Cvlrl6z6yJ3gDDw6M0RhB1TM/4lywcD3i3UYN037P S7ZsIcokyDmwvWxGLIdmDHc5JnsYaHy7+1f6ugP69vpXcnahXw/Ascq8ggOPH+WthTY5 YVJ4jWStpf/0sU2rcgwDCfkRy79bxWmEmE51YssInZk/sKtBy0zyFAexFBLerU2QEyjj M9tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718092248; x=1718697048; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UAtcOHuRzSGyLislV7ie7CX+oVaiZiFwLMGIqPD6yUY=; b=vb+zoL181XwVDK93DoSLhxzsV8g22O1D/xNhZtTEzABY+bTmGbxS+Q0NqnGi+Jtic7 3z0Tv212hsfELP1Fhm9UvxC8TDRYMCgl2+r7nyOfPVBxd6yrqUh4ZaOdA9ESgUbOXpiU ElwWWKSF8ufDu9Y9QyUcz0JiUL4z0vmSuBi1MAFXFfvgntDIWlacO+QPoK8jQAZE08ce ifNTVPEBmkZMFfYgIIrFuiRdEbnnp8L38YW4SElF0UtdIabzypOXaDg964N7fY3BDMRD gBcyVidbM4C5A82rzA+Vm5grwaHnx85fxotVgW1b2A5PV5g8ePLVAPc2T8xUS3fRpOpd GbRw== X-Gm-Message-State: AOJu0YxF+m/B3e8DsycBA3VlLP0MuMR+xTNjCwJYzM3BBF6gJ0FU54nQ Y7Q2je+pq24T86DZUkoBWYRnvU0d6WQ+CYuvXzCFQFF/krLCKsS1kGP9uDexfktHRnjDplwlLg4 16FgGIg== X-Google-Smtp-Source: AGHT+IHNlBTt7mAmtq78eZgDXdcijLRtCEKJFBoTv8PY0G/YjnZSBVYglfX4ej9nDG1bI4uRUSG7J1jdy5f1 X-Received: from dvyukov-desk.muc.corp.google.com ([2a00:79e0:9c:201:ecf:76a8:5d44:6e8b]) (user=dvyukov job=sendgmr) by 2002:a25:ad91:0:b0:df7:d31b:7a29 with SMTP id 3f1490d57ef6-dfaf665abb0mr2530071276.12.1718092248447; Tue, 11 Jun 2024 00:50:48 -0700 (PDT) Date: Tue, 11 Jun 2024 09:50:31 +0200 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <7662127c97e29da1a748ad1c1539dd7b65b737b2.1718092070.git.dvyukov@google.com> Subject: [PATCH v2 2/4] kcov: add interrupt handling self test From: Dmitry Vyukov To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org Cc: linux-kernel@vger.kernel.org, syzkaller@googlegroups.com, elver@google.com, glider@google.com, nogikh@google.com, tarasmadan@google.com, Dmitry Vyukov Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a boot self test that can catch sprious coverage from interrupts. The coverage callback filters out interrupt code, but only after the handler updates preempt count. Some code periodically leaks out of that section and leads to spurious coverage. Add a best-effort (but simple) test that is likely to catch such bugs. If the test is enabled on CI systems that use KCOV, they should catch any issues fast. Signed-off-by: Dmitry Vyukov Reviewed-by: Alexander Potapenko Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: syzkaller@googlegroups.com Reviewed-by: Andrey Konovalov Reviewed-by: Marco Elver --- Changed since v1: - renamed KCOV_TEST to KCOV_SELFTEST - improved the config description - loop for exactly 300ms in the test In my local testing w/o the previous fix, it immidiatly produced the following splat: kcov: running selftest BUG: TASK stack guard page was hit at ffffc90000147ff8 Oops: stack guard page: 0000 [#1] PREEMPT SMP KASAN PTI ... kvm_set_cpu_l1tf_flush_l1d+0x5/0x20 sysvec_call_function+0x15/0xb0 asm_sysvec_call_function+0x1a/0x20 kcov_init+0xe4/0x130 do_one_initcall+0xbc/0x470 kernel_init_freeable+0x4fc/0x930 kernel_init+0x1c/0x2b0 --- kernel/kcov.c | 31 +++++++++++++++++++++++++++++++ lib/Kconfig.debug | 8 ++++++++ 2 files changed, 39 insertions(+) diff --git a/kernel/kcov.c b/kernel/kcov.c index c3124f6d5536..72a5bf55107f 100644 --- a/kernel/kcov.c +++ b/kernel/kcov.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -1057,6 +1058,32 @@ u64 kcov_common_handle(void) } EXPORT_SYMBOL(kcov_common_handle); =20 +#ifdef CONFIG_KCOV_SELFTEST +static void __init selftest(void) +{ + unsigned long start; + + pr_err("running self test\n"); + /* + * Test that interrupts don't produce spurious coverage. + * The coverage callback filters out interrupt code, but only + * after the handler updates preempt count. Some code periodically + * leaks out of that section and leads to spurious coverage. + * It's hard to call the actual interrupt handler directly, + * so we just loop here for a bit waiting for a timer interrupt. + * We set kcov_mode to enable tracing, but don't setup the area, + * so any attempt to trace will crash. Note: we must not call any + * potentially traced functions in this region. + */ + start =3D jiffies; + current->kcov_mode =3D KCOV_MODE_TRACE_PC; + while ((jiffies - start) * MSEC_PER_SEC / HZ < 300) + ; + current->kcov_mode =3D 0; + pr_err("done running self test\n"); +} +#endif + static int __init kcov_init(void) { int cpu; @@ -1076,6 +1103,10 @@ static int __init kcov_init(void) */ debugfs_create_file_unsafe("kcov", 0600, NULL, NULL, &kcov_fops); =20 +#ifdef CONFIG_KCOV_SELFTEST + selftest(); +#endif + return 0; } =20 diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 59b6765d86b8..695a437a52d9 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2171,6 +2171,14 @@ config KCOV_IRQ_AREA_SIZE soft interrupts. This specifies the size of those areas in the number of unsigned long words. =20 +config KCOV_SELFTEST + bool "Perform short selftests on boot" + depends on KCOV + help + Run short KCOV coverage collection selftests on boot. + On test failure, causes the kernel to panic. Recommended to be + enabled, ensuring critical functionality works as intended. + menuconfig RUNTIME_TESTING_MENU bool "Runtime Testing" default y --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 15:44:51 2026 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA325174EC8 for ; Tue, 11 Jun 2024 07:50:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092254; cv=none; b=hHjQe+gkhxnIR/g85vyz5BE8LZXAF0a1CG7mUWUIlE+YiM2dUWEEAJkvF5B8DRS5tb0ofgWXcFmNpHvyaOdxTfcWzp4L6JzL1qkNcn90S9ZP2UKjWa+6EhyXVR4EStPnFv++bqnpGU8gUpPR9aoUs6Od9ML3WTdSa5JNB3X3n7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092254; c=relaxed/simple; bh=02HaGP+l+/mN8/mDpEA4tyGvp1+RJCe805mHVj9C/Go=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=CmX9xmEK38zlsqWHwsArzHctoNeL1wRMnFrWWAkivNg86YF6CVTClJv2+K2THf/OYPPpSYD1NX1/6hB7GxcNWGKbWd9DYCwwu/PwZXfXsHQzwu7BHe7ISaN1QaJwNGBJZhWWH956xFEHA/aV06sj10NTq+64HF6gNEHRlQXkx0k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dvyukov.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PuKktv7S; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dvyukov.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PuKktv7S" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-df7a6530373so9867107276.0 for ; Tue, 11 Jun 2024 00:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718092252; x=1718697052; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=rfoi3weCkLJlClMg6zNq5D1+MumBGC9yK+0o7HU3M94=; b=PuKktv7S7zJMHdWhsbx7J9oCyyKijVQk8fDA2ysR41rq9dVWMQ2FYiZqjBPfJ8lHVv ls7RX+OnIt6emzsTYK+X4g2P40OHCBRJSeGeATBHd0C1R3nAR433Ntktb1V+uw8TBEZ4 mpSwdDBxSYlnEQeoYmHwkX0p0ujkiU5FfiZ5Q51stCe5RrSxDPlg+1FmMD4e4YhYSy/S 01RRBoq3uS/cHYK8ajeJpjgUlO+JaFySUiRmlsUOvwxlKiWMc4B8u2KyGuiyPJmM4yZw zqGEDIDDlKSpHY9TwYNlvv+mMPUwifsbthKC7LgDFZhoV7/wmSiueMBeFm7kmR1DUgxt lYFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718092252; x=1718697052; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rfoi3weCkLJlClMg6zNq5D1+MumBGC9yK+0o7HU3M94=; b=i/Wl4psoCXbfzOo03xJPeVuQQG+AZ7kK6Ph/AlSNqJSV+PHNVCNc9sSsEK/ezgMl/8 T0nWYMNFDL+1SZXGumLiPriyg3uqurbiGLWC5zh8KHgReiDYsVFdsXFgmejdiVK1W62n Jxb2Gb/MROuUkHQbpX0u6lND+qu1vZGjUZmnWotdqv3SbNYVESF5qY8/Jz+6E/Xd67UW 8l5MwEqzHMIC8NJCxfMGW7CP8HgJmNOUHOWBPToTbOf14INeYqaa0V/4QUqCJFdwYD0C R6prQQvAvOtRoUEEUuQ2lEn+BW6xLjH7qwlzU2ciVGLgFK7bn5yY8hfoialFbm3rOIs7 +qdA== X-Gm-Message-State: AOJu0YzLshfNvSkDbIBj98QrBcaNqCk0/fGt7o8a6YBzq3UJsDnnAMlD aiaozSvCOe9aYbvWUt52tTBGR5hoPV5O8Ts878oBPNm1di/fmyEBwZSh/+NjrPXsOVjgqTVYb65 mX70z7A== X-Google-Smtp-Source: AGHT+IFyDS2BFRLxLxooh9UBy3w3KkWkcsvlCgTBgrd7BbaqQ654Bv5CYB20hXbhl3A9/BI4CqENsgWJLOFC X-Received: from dvyukov-desk.muc.corp.google.com ([2a00:79e0:9c:201:ecf:76a8:5d44:6e8b]) (user=dvyukov job=sendgmr) by 2002:a05:6902:1003:b0:dd9:20c1:85b6 with SMTP id 3f1490d57ef6-dfd9fcb617bmr539283276.2.1718092251735; Tue, 11 Jun 2024 00:50:51 -0700 (PDT) Date: Tue, 11 Jun 2024 09:50:32 +0200 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: Subject: [PATCH v2 3/4] module: Fix KCOV-ignored file name From: Dmitry Vyukov To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org Cc: linux-kernel@vger.kernel.org, syzkaller@googlegroups.com, elver@google.com, glider@google.com, nogikh@google.com, tarasmadan@google.com, Dmitry Vyukov , Aaron Tomlin Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Module.c was renamed to main.c, but the Makefile directive was copy-pasted verbatim with the old file name. Fix up the file name. Signed-off-by: Dmitry Vyukov Reviewed-by: Alexander Potapenko Fixes: cfc1d277891e ("module: Move all into module/") Cc: Aaron Tomlin Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: syzkaller@googlegroups.com Reviewed-by: Andrey Konovalov Reviewed-by: Marco Elver --- kernel/module/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/module/Makefile b/kernel/module/Makefile index a10b2b9a6fdf..50ffcc413b54 100644 --- a/kernel/module/Makefile +++ b/kernel/module/Makefile @@ -5,7 +5,7 @@ =20 # These are called from save_stack_trace() on slub debug path, # and produce insane amounts of uninteresting coverage. -KCOV_INSTRUMENT_module.o :=3D n +KCOV_INSTRUMENT_main.o :=3D n =20 obj-y +=3D main.o obj-y +=3D strict_rwx.o --=20 2.45.2.505.gda0bf45e8d-goog From nobody Thu Feb 12 15:44:51 2026 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4F71175543 for ; Tue, 11 Jun 2024 07:50:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092258; cv=none; b=mdXtCKQMcwQTscGaEKk5skiovFzMN84nQdKGmaVJi996HyW8mIGHXnnXiJhxKNw/itoRPGcevMhnF77ngXpDUsss1tj+5PZHRYhOrQBpnGKMze68LtBjGNHNydp0qxvmrf+xUyfd8Ee9yw6aBetumSUoqfdSDuhfM4J8tszj6Vs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092258; c=relaxed/simple; bh=XA6TxpJwG4PvZtHmcUtWg9j+X9JctRACICEBTlJHGpw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=EfXDSCzPnVhnn8usWJAUL1TZ+yjefMtHHhk3XaAEOW4HGioFkaozSZfsT2RrtNuamGbDHpSOZIM0EbJlegHbv5o26L12z7lU5zMB6srtHkRPGamh1NKAOpoc2P+qbSGoOIA72XXrxSYCqYjVQLemz70Y4+4wS3sWGI7smz0fOro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dvyukov.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=gjLfzdl5; arc=none smtp.client-ip=209.85.208.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dvyukov.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gjLfzdl5" Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-57c80b0d1c7so387159a12.0 for ; Tue, 11 Jun 2024 00:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718092255; x=1718697055; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KJ1zyFICdy5qqRC7FAeNtn1bVJ8F8bJSOBOHZzBToA4=; b=gjLfzdl5+LUCC1ZZB4Ha7DmD6fx52l5i4e+f5EcxjOq9IjipOCL0ApKUck1y4w7CjO /JAnnC+aWQoeRGxMOdDkJw8GINO09S+z9YBz58fqZW0B1jetQ3dgbDY83VwrijuhNsXC hFESLe2o587cEGg+eomXArmB68kR7o4gBOzcVB8FiF178oNrfurrDv1px1xSmACN+qte tN4Vq6Jvu2ZNYjn3Sqa1GNGYKE12mPTmwbBhTqBdo/7uWnVsxSD4p/osWn6QFBY8fpGm lcrQXj/2hGQWVeLELwXdJ2Osc3OYQccyTOZQ1nGQnuBzFrPFdMk3f5uZ1+W2/UtDw72U Tp8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718092255; x=1718697055; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KJ1zyFICdy5qqRC7FAeNtn1bVJ8F8bJSOBOHZzBToA4=; b=nRkSDh/32sJss4Z03YkE6SJ7wvfVDmhpRE8WJZKzFc7sQHtCgdVSur/FELcftAl4ke ADV+rqvN+aXQltTmyx3LDcjUCYQr+eolVG5Tery9tmi4kp6vW4C1fbyKeRoqTGqCsgnc VbG1TmLynhpHPdk/v5nO9z6YMMHXEnq9TSQh0BV/cEL2lemGfskbCvnJm7iw8mjSi99Q 5+1bjmer8ail3WLO3FbTu3h0nxrY1VgsnBEDIhuiwl/MYZEIdzlj0nbUXqKfB9sAI/iy +qHOe4Hus0JMDXoRUO3aL6hsyuwO9sl9UL0hWbK9M/xAvqk8N7YwW0UfQpEPlD5bWGCC k2Rw== X-Gm-Message-State: AOJu0Yw7FIVodoxybMAykdVePROFh/H1sTCfjkmjr6gxVrQfgP78/Oys /xr3coKaw2auIndRGQQC/kpSnG8KCRmXrZhAa+OHodnoC38LlHS15DjBC3EKuLMrTBrBmq1WO4x ddJK5IA== X-Google-Smtp-Source: AGHT+IGJJKwfA8KHq/ehZGxXBnsy8ol4aDTYkjUd2Q5SfKYFKqYpga3FUafEhpFt0lpekDAn4m8qAO4eL7fj X-Received: from dvyukov-desk.muc.corp.google.com ([2a00:79e0:9c:201:ecf:76a8:5d44:6e8b]) (user=dvyukov job=sendgmr) by 2002:a05:6402:5418:b0:57c:7f32:312c with SMTP id 4fb4d7f45d1cf-57c7f32333bmr7090a12.2.1718092255002; Tue, 11 Jun 2024 00:50:55 -0700 (PDT) Date: Tue, 11 Jun 2024 09:50:33 +0200 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: Subject: [PATCH v2 4/4] x86: Ignore stack unwinding in KCOV From: Dmitry Vyukov To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org Cc: linux-kernel@vger.kernel.org, syzkaller@googlegroups.com, elver@google.com, glider@google.com, nogikh@google.com, tarasmadan@google.com, Dmitry Vyukov Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Stack unwinding produces large amounts of uninteresting coverage. It's called from KASAN kmalloc/kfree hooks, fault injection, etc. It's not particularly useful and is not a function of system call args. Ignore that code. Signed-off-by: Dmitry Vyukov Reviewed-by: Alexander Potapenko Reviewed-by: Marco Elver Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: syzkaller@googlegroups.com Acked-by: Peter Zijlstra (Intel) Reviewed-by: Andrey Konovalov --- arch/x86/kernel/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 20a0dd51700a..cd49ebfae984 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -39,6 +39,14 @@ KMSAN_SANITIZE_sev.o :=3D n # first second. KCOV_INSTRUMENT_head$(BITS).o :=3D n KCOV_INSTRUMENT_sev.o :=3D n +# These are called from save_stack_trace() on debug paths, +# and produce large amounts of uninteresting coverage. +KCOV_INSTRUMENT_stacktrace.o :=3D n +KCOV_INSTRUMENT_dumpstack.o :=3D n +KCOV_INSTRUMENT_dumpstack_$(BITS).o :=3D n +KCOV_INSTRUMENT_unwind_orc.o :=3D n +KCOV_INSTRUMENT_unwind_frame.o :=3D n +KCOV_INSTRUMENT_unwind_guess.o :=3D n =20 CFLAGS_irq.o :=3D -I $(src)/../include/asm/trace =20 --=20 2.45.2.505.gda0bf45e8d-goog