BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/3] rcu/tasks: Export call_rcu_tasks_rude()
Date: Mon, 28 Sep 2026 14:39:20 +0000	[thread overview]
Message-ID: <20260928143920.D383B1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <179060576723.372125.8212099501235098804.stgit@devnote2>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] rcu: missing rcu_barrier_tasks_rude() causes UAF on module unload
--

commit ba4806c534fb61d71e190abff5c0d237c0eb2648
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>

rcu/tasks: Export call_rcu_tasks_rude()

This commit exports call_rcu_tasks_rude() so that subsystems executing
handlers under preempt_disable() can safely use an asynchronous variant. It
also provides fallbacks to call_rcu when Tasks Rude RCU is not configured.

> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -198,7 +198,11 @@ void rcu_tasks_torture_stats_print(char *tt, char *tf);
>  
>  # ifdef CONFIG_TASKS_RUDE_RCU
>  void synchronize_rcu_tasks_rude(void);
> +void call_rcu_tasks_rude(struct rcu_head *rhp, rcu_callback_t func);

[Severity: High]
Since the asynchronous callback API is being exposed for external use, does
there also need to be an rcu_barrier_tasks_rude() declared so that modules
can safely tear down and wait for pending callbacks?

>  void rcu_tasks_rude_torture_stats_print(char *tt, char *tf);
> +# else
> +# define call_rcu_tasks_rude call_rcu
> +# define synchronize_rcu_tasks_rude synchronize_rcu

[Severity: High]
If a barrier function is introduced, will this fallback block also need a
corresponding fallback definition like
#define rcu_barrier_tasks_rude rcu_barrier?

>  # endif

[ ... ]

> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h

[ ... ]

> -static void call_rcu_tasks_rude(struct rcu_head *rhp, rcu_callback_t func)
> +void call_rcu_tasks_rude(struct rcu_head *rhp, rcu_callback_t func)
>  {
>  	call_rcu_tasks_generic(rhp, func, &rcu_tasks_rude);
>  }
> +EXPORT_SYMBOL_GPL(call_rcu_tasks_rude);

[Severity: High]
If a loadable module uses this API with a callback pointing into its own text
section, how does its module_exit function wait for the callback to finish
executing before the module unloads? Without an exported barrier function,
could this lead to a use-after-free or invalid instruction execution when the
pending callback is invoked in freed or unmapped memory?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/179060575297.372125.10581329083761385407.stgit@devnote2?part=1

  reply	other threads:[~2026-09-28 14:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 14:29 [RFC PATCH 0/3] fprobe, rcu/tasks, rhashtable: Switch fprobe and BPF kprobe-multi to Tasks-Rude RCU Masami Hiramatsu (Google)
2026-09-28 14:29 ` [RFC PATCH 1/3] rcu/tasks: Export call_rcu_tasks_rude() Masami Hiramatsu (Google)
2026-09-28 14:39   ` sashiko-bot [this message]
2026-09-28 15:17   ` bot+bpf-ci
2026-09-28 14:29 ` [RFC PATCH 2/3] rhashtable: Add use_tasks_rude parameter to defer bucket table free Masami Hiramatsu (Google)
2026-09-28 14:43   ` sashiko-bot
2026-09-28 14:29 ` [RFC PATCH 3/3] fprobe: Switch fprobe and BPF kprobe-multi to Tasks-Rude RCU Masami Hiramatsu (Google)
2026-09-28 14:46   ` sashiko-bot
2026-09-28 16:25 ` [RFC PATCH 0/3] fprobe, rcu/tasks, rhashtable: " Paul E. McKenney
2026-09-28 23:28   ` Masami Hiramatsu
2026-09-29  0:04     ` Paul E. McKenney
2026-09-29  0:33       ` Andrii Nakryiko
2026-09-29  0:41         ` Paul E. McKenney
2026-09-30  0:35           ` Masami Hiramatsu
2026-09-30  0:47             ` Paul E. McKenney

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=20260928143920.D383B1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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