Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>, linux-trace-kernel@vger.kernel.org
Cc: jpoimboe@kernel.org, rostedt@goodmis.org, peterz@infradead.org,
	mingo@redhat.com, tglx@kernel.org, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org,
	catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
	pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
	alex@ghiti.fr, acme@kernel.org, namhyung@kernel.org,
	linux-perf-users@vger.kernel.org, mhiramat@kernel.org,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	bpf@vger.kernel.org, nathan@kernel.org, nsc@kernel.org,
	linux-kbuild@vger.kernel.org, ojeda@kernel.org, ardb@kernel.org,
	linux-efi@vger.kernel.org, "Marc Zyngier" <maz@kernel.org>,
	"Oliver Upton" <oupton@kernel.org>,
	kvmarm@lists.linux.dev, shuah@kernel.org, indu.bhagat@oracle.com,
	jremus@linux.ibm.com, wnliu@google.com, dylanbhatch@google.com,
	gary@garyguo.net
Subject: Re: [RFC PATCH v2 01/30] unwind: Add Minimal DWARF CFI bytecode interpreter
Date: Wed, 25 Nov 2026 06:32:09 +0000	[thread overview]
Message-ID: <sashiko-outbox-232708@kernel.org> (raw)
In-Reply-To: <20261125061523.1540234-2-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] unwind: dwarf_cfi: noinstr violations via
  kmsan_unpoison_memory() and likely()
--

commit a47eb90bddad018f7c1af29e002c5e94dbaf8bab
Author: Ian Rogers <irogers@google.com>

unwind: Add Minimal DWARF CFI bytecode interpreter

This commit adds a bounded DWARF Call Frame Information (.eh_frame and
.eh_frame_hdr) bytecode interpreter for kernel, module, and user-space
stack unwinding.

> diff --git a/kernel/unwind/Makefile b/kernel/unwind/Makefile
> index eae37bea54fdb..f772fc6079855 100644
> --- a/kernel/unwind/Makefile
> +++ b/kernel/unwind/Makefile
> @@ -1 +1,11 @@
> - obj-$(CONFIG_UNWIND_USER)	+= user.o deferred.o
> +ifdef CONFIG_FUNCTION_TRACER
> +CFLAGS_REMOVE_dwarf_cfi.o = $(CC_FLAGS_FTRACE)
> +endif
> +KASAN_SANITIZE_dwarf_cfi.o := n
> +KCSAN_SANITIZE_dwarf_cfi.o := n
> +UBSAN_SANITIZE_dwarf_cfi.o := n
> +KMSAN_SANITIZE_dwarf_cfi.o := n
> +KCOV_INSTRUMENT_dwarf_cfi.o := n
> +
> +obj-$(CONFIG_UNWIND_DWARF_CFI)		+= dwarf_cfi.o
> +obj-$(CONFIG_UNWIND_USER)		+= user.o deferred.o
> diff --git a/kernel/unwind/dwarf_cfi.c b/kernel/unwind/dwarf_cfi.c
> new file mode 100644
> index 0000000000000..8b8004b1b8d15
> --- /dev/null
> +++ b/kernel/unwind/dwarf_cfi.c

[ ... ]

> +static __always_inline int
> +dwarf_cfi_eval_fde_streams(struct dwarf_cfi_stream *cie_s,
> +			   struct dwarf_cfi_stream *fde_s,
> +			   unsigned long pc,
> +			   const struct dwarf_cfi_arch *arch,
> +			   struct dwarf_cfi_row *out_row,
> +			   bool is_user)
> +{

[ ... ]

> +	*out_row = row;
> +	kmsan_unpoison_memory(out_row, sizeof(*out_row));
> +	return 0;
> +}

[ ... ]

> +noinstr int dwarf_cfi_eval_fde_kmem(const u8 *fde, const u8 *eh_start,
> +				    const u8 *eh_end, unsigned long pc,
> +				    const struct dwarf_cfi_arch *arch,
> +				    struct dwarf_cfi_row *out_row)
> +{

[ ... ]

> +	return dwarf_cfi_eval_fde_streams(&cie_s, &fde_s, pc, arch, out_row,
> +					  /*is_user=*/false);
> +}

[Severity: Medium]
Can the noinstr functions in dwarf_cfi.c call into instrumented .text when
CONFIG_KMSAN or CONFIG_TRACE_BRANCH_PROFILING is enabled?

dwarf_cfi_eval_fde_kmem() is marked noinstr and inlines
dwarf_cfi_eval_fde_streams(), which calls kmsan_unpoison_memory().
Because kmsan_unpoison_memory() in include/linux/kmsan-checks.h is gated
on CONFIG_KMSAN rather than __SANITIZE_MEMORY__, KMSAN_SANITIZE_dwarf_cfi.o := n
does not stub it out, leaving a direct call from .noinstr.text to .text.

In addition, neither kernel/unwind/Makefile nor dwarf_cfi.c defines
DISABLE_BRANCH_PROFILING, so under CONFIG_TRACE_BRANCH_PROFILING=y every
likely() and unlikely() in the noinstr functions and their inlined helpers
expands to a call to ftrace_likely_update() in .text, triggering objtool
noinstr warnings and running instrumented code in noinstr contexts.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125061523.1540234-1-irogers@google.com?part=1

  reply	other threads:[~2026-11-25  6:32 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  6:14 [RFC PATCH v2 00/30] unwind: Minimal DWARF CFI unwinding for user and kernel space Ian Rogers
2026-11-25  6:14 ` [RFC PATCH v2 01/30] unwind: Add Minimal DWARF CFI bytecode interpreter Ian Rogers
2026-11-25  6:32   ` sashiko-bot [this message]
2026-11-25  7:05   ` bot+bpf-ci
2026-11-25  6:14 ` [RFC PATCH v2 02/30] unwind: Add KUnit tests for Minimal DWARF CFI interpreter Ian Rogers
2026-11-25  7:05   ` bot+bpf-ci
2026-11-25  6:14 ` [RFC PATCH v2 03/30] unwind_user: Support Minimal DWARF CFI user-space unwinding Ian Rogers
2026-11-25  7:05   ` bot+bpf-ci
2026-11-25  6:14 ` [RFC PATCH v2 04/30] x86: unwind_user: Support Minimal DWARF CFI user unwinding Ian Rogers
2026-11-25  6:47   ` bot+bpf-ci
2026-11-25  6:14 ` [RFC PATCH v2 05/30] scripts: Add min_eh_frame build-time .eh_frame minifier Ian Rogers
2026-11-25  7:06   ` bot+bpf-ci
2026-11-25  6:14 ` [RFC PATCH v2 06/30] kbuild: Wire up CONFIG_UNWINDER_DWARF_CFI_MINIFY object pass Ian Rogers
2026-11-25  6:32   ` sashiko-bot
2026-11-25  6:15 ` [RFC PATCH v2 07/30] objtool/ibt: Ignore .eh_frame relocations during ENDBR validation Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 08/30] vmlinux.lds.h: Allow architectures to emit custom RO_DATA sections Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 09/30] efi/libstub: Disable unwind tables in x86 and RISC-V EFI stubs Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 10/30] tracing: Skip internal ftrace frames under CONFIG_UNWINDER_DWARF_CFI Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 11/30] x86: Add DWARF CFI annotations to entry, ftrace, frame, and rethook Ian Rogers
2026-11-25  7:05   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 12/30] x86/unwind: Add Minimal DWARF CFI kernel unwinder Ian Rogers
2026-11-25  7:06   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 13/30] lib/Kconfig.debug: Allow LATENCYTOP and fault-injection filter with DWARF CFI Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 14/30] arm64: unwind_user: Support Minimal DWARF CFI and FP user unwinding Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 15/30] arm64: Add DWARF CFI annotations to entry, ftrace, EFI, BPF, and KASAN Ian Rogers
2026-11-25  7:06   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 16/30] arm64/unwind: Add Minimal DWARF CFI kernel unwinder Ian Rogers
2026-11-25  7:06   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 17/30] riscv: unwind_user: Support Minimal DWARF CFI and FP user unwinding Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 18/30] riscv: Add DWARF CFI annotations to entry, ftrace, rethook, and BPF JIT Ian Rogers
2026-11-25  7:06   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 19/30] riscv/unwind: Add Minimal DWARF CFI kernel unwinder Ian Rogers
2026-11-25  6:47   ` sashiko-bot
2026-11-25  7:06   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 20/30] selftests/perf_events: Add Minimal DWARF CFI deferred user unwind test Ian Rogers
2026-11-25  7:05   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 21/30] scripts: Add eh_frame_min.py .eh_frame coverage and size analyzer Ian Rogers
2026-11-25  7:05   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 22/30] tools headers: Add linux/kmsan-checks.h copy from the kernel sources Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 23/30] tools headers: Add linux/nospec.h " Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 24/30] tools headers: Add linux/unwind_dwarf_cfi.h " Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 25/30] tools include: Add linux/uaccess.h stub for userspace tools Ian Rogers
2026-11-25  6:15 ` [RFC PATCH v2 26/30] tools/unwind: Add standalone libLLVM Minimal DWARF CFI verifier Ian Rogers
2026-11-25  6:37   ` sashiko-bot
2026-11-25  7:06   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 27/30] tools/unwind: Add multi-arch symbolic instruction lifters for verify_cfi Ian Rogers
2026-11-25  6:38   ` sashiko-bot
2026-11-25  7:05   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 28/30] tools/unwind: Add CFG instruction abstract execution oracle to verify_cfi Ian Rogers
2026-11-25  7:06   ` bot+bpf-ci
2026-11-25  6:15 ` [RFC PATCH v2 29/30] tools/unwind: Add x86-64 ORC cross-check " Ian Rogers
2026-11-25  6:40   ` sashiko-bot
2026-11-25  6:15 ` [RFC PATCH v2 30/30] MAINTAINERS: Add DWARF CFI stack unwinding entry Ian Rogers

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=sashiko-outbox-232708@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acme@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=andrii@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=ardb@kernel.org \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel@iogearbox.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=dylanbhatch@google.com \
    --cc=gary@garyguo.net \
    --cc=indu.bhagat@oracle.com \
    --cc=irogers@google.com \
    --cc=jpoimboe@kernel.org \
    --cc=jremus@linux.ibm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=oupton@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=peterz@infradead.org \
    --cc=pjw@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shuah@kernel.org \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    --cc=wnliu@google.com \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox