Live Patching
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dylan Hatch" <dylanbhatch@google.com>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	"Weinan Liu" <wnliu@google.com>, "Will Deacon" <will@kernel.org>,
	"Josh Poimboeuf" <jpoimboe@kernel.org>,
	"Indu Bhagat" <ibhagatgnu@gmail.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Jiri Kosina" <jikos@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Jens Remus" <jremus@linux.ibm.com>
Cc: "Prasanna Kumar T S M" <ptsm@linux.microsoft.com>,
	"Puranjay Mohan" <puranjay@kernel.org>,
	"Song Liu" <song@kernel.org>,
	joe.lawrence@redhat.com, live-patching@vger.kernel.org,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Mostafa Saleh" <smostafa@google.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH v9 05/11] module, sframe: Add sframe support for modules
Date: Tue, 17 Nov 2026 02:34:49 +0000	[thread overview]
Message-ID: <sashiko-outbox-218091@kernel.org> (raw)
In-Reply-To: <20261117020648.323464-6-dylanbhatch@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] unwind/sframe: noinstr violation calling rcu_is_watching() in
  sframe_find()
--

commit 777f63a65edfda582b87b92a3b49553c49d8a38c
Author: Dylan Hatch <dylanbhatch@google.com>

module, sframe: Add sframe support for modules

This commit adds SFrame section tracking and FDE sorting to struct module
and extends sframe_find() to look up PCs in loaded modules.

> diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c
> index 50afaed9a0c93..55b7838bdd485 100644
> --- a/kernel/unwind/sframe.c
> +++ b/kernel/unwind/sframe.c

[ ... ]

> @@ -411,12 +416,53 @@ static __always_inline int __sframe_find(struct sframe_section *sec,
>  	return __find_fre(sec, &fde, ip, frame);
>  }
>  
> -notrace int sframe_find(unsigned long ip, struct unwind_frame *frame)
> +#ifdef CONFIG_MODULES
> +
> +static __always_inline int __sframe_find_module(unsigned long ip,
> +						struct unwind_frame *frame)
> +{
> +	struct module *mod;
> +	int ret;
> +
> +	if (!rcu_is_watching())
> +		return -EINVAL;
> +
> +	instrumentation_begin();
> +	scoped_guard(preempt_notrace) {
> +		mod = __module_text_address(ip);
> +		if (mod && smp_load_acquire(&mod->sframe_init))
> +			ret = __sframe_find(&mod->sframe_sec, ip, frame);
> +		else
> +			ret = -EINVAL;
> +	}
> +	instrumentation_end();
> +
> +	return ret;
> +}
> +
> +#else
> +
> +static __always_inline int __sframe_find_module(unsigned long ip,
> +						struct unwind_frame *frame)
> +{
> +	return -EINVAL;
> +}
> +
> +#endif
> +
> +noinstr int sframe_find(unsigned long ip, struct unwind_frame *frame)

[Severity: Medium]
Does calling rcu_is_watching() before instrumentation_begin() in
__sframe_find_module() violate noinstr rules for sframe_find()?

In kernel/rcu/tree.c, rcu_is_watching() is marked notrace rather than
noinstr, so it lives in .text and can be instrumented by sanitizers such as
KASAN or KCSAN.  Calling it from noinstr sframe_find() before
instrumentation_begin() triggers an objtool noinstr validation warning when
CONFIG_NOINSTR_VALIDATION is enabled and can run instrumented code while
unwinding from a context where RCU is not watching.

Using the __always_inline rcu_is_watching_curr_cpu() helper inside the
preempt_notrace guard before instrumentation_begin() would keep the check
in noinstr context and avoid toggling preemption twice.

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

  reply	other threads:[~2026-11-17  2:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  2:06 [PATCH v9 00/11] unwind, arm64: add sframe unwinder for kernel Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 01/11] arm64, unwind: build kernel with sframe V3 info Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 02/11] arm64/sframe: Read vmlinux .sframe header Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 03/11] sframe: Add support for reading vmlinux .sframe contents Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 04/11] sframe: Separate reading of FRE from reading of FRE data words Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 05/11] module, sframe: Add sframe support for modules Dylan Hatch
2026-11-17  2:34   ` sashiko-bot [this message]
2026-11-17  2:06 ` [PATCH v9 06/11] arm64/sframe: Validate IP addresses Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 07/11] sframe: Add debug helpers with object name Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 08/11] sframe: Add .sframe validation option Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 09/11] arm64: entry: add unwind info for call_on_irq_stack() Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 10/11] arm64, crypto/lib: Annotate leaf functions with CFI info Dylan Hatch
2026-11-17  2:06 ` [PATCH v9 11/11] unwind: arm64: Use sframe to unwind interrupt frames Dylan Hatch
2026-11-17  3:19   ` sashiko-bot

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-218091@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=dylanbhatch@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ibhagatgnu@gmail.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=jremus@linux.ibm.com \
    --cc=live-patching@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=peterz@infradead.org \
    --cc=ptsm@linux.microsoft.com \
    --cc=puranjay@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=smostafa@google.com \
    --cc=song@kernel.org \
    --cc=will@kernel.org \
    --cc=wnliu@google.com \
    /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