From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sashal@kernel.org>,
linux-kernel@vger.kernel.org, Bill Wendling <morbo@google.com>,
Chuck Wolber <chuck@wolber.net>,
Justin Stitt <justinstitt@google.com>,
llvm@lists.linux.dev, Marco Elver <elver@google.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Thomas Gleixner <tglx@kernel.org>
Subject: Re: [PATCH v2 11/20] objtool: Detect code coverage instrumentation in noinstr code
Date: Thu, 12 Nov 2026 10:51:35 -0800 [thread overview]
Message-ID: <avYKUgK8eeFQ2rS_@jpoimboe> (raw)
In-Reply-To: <avX80WkCFuGyS1y0@jpoimboe>
On Thu, Nov 12, 2026 at 10:41:46AM -0800, Josh Poimboeuf wrote:
> On Thu, Nov 12, 2026 at 04:12:32PM +0100, Peter Zijlstra wrote:
> > On Thu, Nov 12, 2026 at 08:09:06AM -0500, Sasha Levin wrote:
> > > On Wed, Nov 11, 2026 at 10:23:41PM -0800, Josh Poimboeuf wrote:
> > > >What exactly is the problem with noinstr code incrementing counters
> > > >inline?
> > >
> > > The counter is a memory write, and a memory write can trap. In noinstr
> > > code that can happen before we're ready to take another exception.
> > >
> > > With GCOV_PROFILE_ALL today, exc_debug_kernel() bumps a counter before
> > > it clears DR7. Set a watchpoint on that counter and the next kernel #DB
> > > never returns, it just keeps re-entering the handler. I tried it on
> > > v7.4-rc1 in a VM and it hangs.
> > >
> > > noinstr is already supposed to keep these out, it has had __no_profile
> > > for years. But that doesn't cover what gets inlined into it, and nothing
> > > checks. This patch adds the check.
> >
> > Right, strictly speaking this is a toolchain bug, but since we need to
> > build with existing tools we need to bodge it somewhat :/
>
> I must be missing something, if somebody sets a watchpoint in
> exc_debug_kernel(), don't they get to keep the pieces?
Or rather, sets a watchpoint on a counter specific to
exc_debug_kernel()... Still, why would somebody do that.
> It's also not clear why --hack-noinstr can't be extended to either NOP
> out the affected instructions, or change the address relocation to point
> to a dummy variable that won't trap.
>
> And the changelog needs all that background, as the justification is not
> clear at all (to me).
--
Josh
next prev parent reply other threads:[~2026-11-12 18:51 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 1:52 [PATCH v2 00/20] Unify code coverage and add Clang source-based coverage with MC/DC Sasha Levin
2026-11-03 1:52 ` [PATCH v2 01/20] coverage: move gcov and kcov under kernel/coverage/ Sasha Levin
2026-11-05 17:38 ` Peter Oberparleiter
2026-11-13 0:45 ` Nathan Chancellor
2026-11-03 1:52 ` [PATCH v2 02/20] kbuild: unify static coverage instrumentation as COVERAGE_PROFILE Sasha Levin
2026-11-04 1:53 ` sashiko-bot
2026-11-13 0:45 ` Nathan Chancellor
2026-11-03 1:52 ` [PATCH v2 03/20] coverage: add a common debugfs interface Sasha Levin
2026-11-05 17:49 ` Peter Oberparleiter
2026-11-06 1:05 ` Sasha Levin
2026-11-03 1:52 ` [PATCH v2 04/20] compiler_types.h: Don't instrument __always_inline functions for coverage Sasha Levin
2026-11-03 1:52 ` [PATCH v2 05/20] context_tracking: Always inline the empty stubs called from noinstr code Sasha Levin
2026-11-03 1:52 ` [PATCH v2 06/20] lockdep: " Sasha Levin
2026-11-03 1:52 ` [PATCH v2 07/20] perf: Always inline the empty perf_lopwr_cb() stub Sasha Levin
2026-11-04 1:53 ` sashiko-bot
2026-11-03 1:52 ` [PATCH v2 08/20] rseq: Always inline the empty stubs called from noinstr code Sasha Levin
2026-11-03 1:52 ` [PATCH v2 09/20] x86: Always inline " Sasha Levin
2026-11-03 1:52 ` [PATCH v2 10/20] x86/sev: Use non-instrumented bitops in the GHCB accessors Sasha Levin
2026-11-04 13:36 ` Sean Christopherson
2026-11-03 1:52 ` [PATCH v2 11/20] objtool: Detect code coverage instrumentation in noinstr code Sasha Levin
2026-11-12 6:23 ` Josh Poimboeuf
2026-11-12 13:09 ` Sasha Levin
2026-11-12 15:12 ` Peter Zijlstra
2026-11-12 18:41 ` Josh Poimboeuf
2026-11-12 18:51 ` Josh Poimboeuf [this message]
2026-11-13 15:09 ` Sasha Levin
2026-11-13 18:22 ` Josh Poimboeuf
2026-11-03 1:52 ` [PATCH v2 12/20] x86/sev: Stop excluding noinstr.o from code coverage Sasha Levin
2026-11-03 1:52 ` [PATCH v2 13/20] x86/entry: Stop excluding the entry code from KCOV Sasha Levin
2026-11-03 1:52 ` [PATCH v2 14/20] coverage: add Clang's source-based code coverage Sasha Levin
2026-11-04 1:53 ` sashiko-bot
2026-11-03 1:52 ` [PATCH v2 15/20] x86: Enable " Sasha Levin
2026-11-03 1:52 ` [PATCH v2 16/20] coverage: add MC/DC measurement Sasha Levin
2026-11-13 0:45 ` Nathan Chancellor
2026-11-03 1:52 ` [PATCH v2 17/20] gcov: fix gcov_info_add() merge semantics for IOR counters Sasha Levin
2026-11-05 17:50 ` Peter Oberparleiter
2026-11-03 1:52 ` [PATCH v2 18/20] kconfig: add CC_HAS_CONDITION_COVERAGE for MC/DC support detection Sasha Levin
2026-11-13 0:45 ` Nathan Chancellor
2026-11-03 1:52 ` [PATCH v2 19/20] gcov: add MC/DC condition coverage support Sasha Levin
2026-11-05 17:56 ` Peter Oberparleiter
2026-11-06 1:05 ` Sasha Levin
2026-11-03 1:52 ` [PATCH v2 20/20] Documentation: dev-tools: document the common code coverage interface Sasha Levin
2026-11-05 17:36 ` [PATCH v2 00/20] Unify code coverage and add Clang source-based coverage with MC/DC Peter Oberparleiter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avYKUgK8eeFQ2rS_@jpoimboe \
--to=jpoimboe@kernel.org \
--cc=chuck@wolber.net \
--cc=elver@google.com \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mhiramat@kernel.org \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=sashal@kernel.org \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.