From: sashiko-bot@kernel.org
To: wen.yang@linux.dev
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v6 4/4] rv/reactors: add KUnit tests for reactor registration and dispatch
Date: Mon, 14 Sep 2026 19:28:01 +0000 [thread overview]
Message-ID: <20260914192802.248CC1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <7d213b110815da45595ad8cd7bcce5641fac3404.1789412799.git.wen.yang@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing module reference counting for RV reactors leads to a Use-After-Free if a reactor module is unloaded while still assigned to a monitor.
--
commit ad2a08e6decf463e8a9bfc030b93a95b3cf6f3b1
Author: Wen Yang <wen.yang@linux.dev>
rv/reactors: add KUnit tests for reactor registration and dispatch
Add KUnit tests covering the reactor register/unregister lifecycle
(including duplicate and name-length rejection) and rv_react() dispatch
(a no-op without a callback, exactly one invocation with one).
> diff --git a/kernel/trace/rv/rv_reactors_kunit.c b/kernel/trace/rv/rv_reactors_kunit.c
> new file mode 100644
> index 0000000000000..3850c6dda288f
> --- /dev/null
> +++ b/kernel/trace/rv/rv_reactors_kunit.c
[ ... ]
> +static void reactor_teardown(void *arg)
> +{
> + rv_unregister_reactor(&test_reactor);
[Severity: High]
This is a pre-existing issue, but could rv_unregister_reactor() leave
dangling pointers if a dynamically loaded reactor module is unloaded while
still assigned to a monitor?
Looking at rv_unregister_reactor() in kernel/trace/rv/rv_reactors.c, it
removes the reactor from the global list but does not appear to iterate over
active monitors to detach it.
Furthermore, in monitor_swap_reactors_single(), the reactor is assigned to
the monitor without taking a module reference count via try_module_get():
kernel/trace/rv/rv_reactors.c:monitor_swap_reactors_single() {
...
mon->reactor = reactor;
mon->react = reactor->react;
...
}
If a user with tracefs access assigns a dynamically loaded reactor (e.g.,
reactor_printk.ko) to an RV monitor and then unloads the reactor module,
when the monitor's tracepoint fires, rv_react() would invoke the dangling
monitor->react function pointer.
Could this jump into the unmapped memory of the unloaded module and cause
a use-after-free?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1789412799.git.wen.yang@linux.dev?part=4
next prev parent reply other threads:[~2026-09-14 19:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 19:13 [PATCH v6 0/4] rv/reactors: fix lockdep warning and add tests wen.yang
2026-09-14 19:13 ` [PATCH v6 1/4] rv/reactors: use LD_WAIT_SPIN as the reactor lockdep wait type wen.yang
2026-09-14 19:13 ` [PATCH v6 2/4] rv/reactors: propagate rv_register_reactor() error from reactor init wen.yang
2026-09-14 19:13 ` [PATCH v6 3/4] rv/reactors: export rv_register_reactor() and rv_unregister_reactor() wen.yang
2026-09-14 19:25 ` sashiko-bot
2026-09-14 19:13 ` [PATCH v6 4/4] rv/reactors: add KUnit tests for reactor registration and dispatch wen.yang
2026-09-14 19:28 ` sashiko-bot [this message]
2026-09-17 11:42 ` [PATCH v6 0/4] rv/reactors: fix lockdep warning and add tests Gabriele Monaco
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=20260914192802.248CC1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wen.yang@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