From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: sashiko-reviews@lists.linux.dev, sashiko-bot@kernel.org,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v12 03/11] HWBP: Add modify_local_hw_breakpoint_addr() API
Date: Thu, 20 Aug 2026 22:43:34 +0900 [thread overview]
Message-ID: <20260820224334.faf2b4f78b383318748a8ff5@kernel.org> (raw)
In-Reply-To: <20260820091443.f839ba0d307a810714ea8f27@kernel.org>
On Thu, 20 Aug 2026 09:14:43 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> > Pre-existing issues:
> > - [High] Lockless traversal of `kprobe_blacklist` can lead to Use-After-Free during module unload.
>
> This seems a funny hallucination... why have you pointed unrelated kprobe things??
Ah, no.
> > [Severity: High]
> > This is a pre-existing issue, but can the lockless traversal in the
> > blacklist check lead to a use-after-free during module unload?
> >
> > When parsing the breakpoint, the call chain goes through:
> > arch_modify_local_hw_breakpoint_addr() -> hw_breakpoint_arch_parse() ->
> > arch_build_bp_info() -> within_kprobe_blacklist()
Hmm, why it checks kprobe_blacklist... that is for kprobe handlers (mainly
because avoiding obviously nested kprobes). Anyway, we can make the list
rcu-safe.
> >
> > kernel/kprobes.c:__within_kprobe_blacklist() {
> > ...
> > list_for_each_entry(ent, &kprobe_blacklist, list) {
> > if (addr >= ent->start_addr && addr < ent->end_addr)
> > return true;
> > }
> > ...
> > }
> >
> > If a module is unloaded concurrently, kprobe_remove_area_blacklist() deletes
> > entries and immediately frees them with kfree(). Would a concurrent hardware
> > breakpoint modification dereference freed memory here since kprobe_mutex
> > is not held and RCU protection is not used?
Yes, it will be possible.
Thanks,
> >
> > > + if (ret) {
> > > + counter_arch_bp(bp)->address = old_addr;
> > > + bp->attr.bp_addr = old_addr;
> > > + return ret;
> > > + }
> > > +
> > > + return 0;
> > > +}
> >
> > --
> > Sashiko AI review · https://sashiko.dev/#/patchset/178611679753.237811.10190793347982785419.stgit@devnote2?part=3
>
>
> --
> Masami Hiramatsu (Google) <mhiramat@kernel.org>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2026-08-20 13:43 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 15:33 [PATCH v12 00/11] tracing: wprobe: x86: Add wprobe for watchpoint Masami Hiramatsu (Google)
2026-08-07 15:33 ` [PATCH v12 01/11] x86/hw_breakpoints: Make DR7 updates NMI safe Masami Hiramatsu (Google)
2026-08-07 16:01 ` sashiko-bot
2026-08-07 15:33 ` [PATCH v12 02/11] x86/hw_breakpoints: Add arch_modify_local_hw_breakpoint_addr() API Masami Hiramatsu (Google)
2026-08-07 15:50 ` sashiko-bot
2026-08-19 23:54 ` Masami Hiramatsu
2026-08-07 15:33 ` [PATCH v12 03/11] HWBP: Add modify_local_hw_breakpoint_addr() API Masami Hiramatsu (Google)
2026-08-07 15:58 ` sashiko-bot
2026-08-20 0:14 ` Masami Hiramatsu
2026-08-20 13:43 ` Masami Hiramatsu [this message]
2026-08-07 15:34 ` [PATCH v12 04/11] tracing/wprobe: Add wprobe (watchpoint probe) trace event support Masami Hiramatsu (Google)
2026-08-07 15:59 ` sashiko-bot
2026-08-21 0:21 ` Masami Hiramatsu
2026-08-17 11:51 ` Jinchao Wang
2026-08-18 22:35 ` Masami Hiramatsu
2026-08-07 15:34 ` [PATCH v12 05/11] x86: hw_breakpoint: Add a kconfig to clarify when a breakpoint fires Masami Hiramatsu (Google)
2026-08-17 12:10 ` Jinchao Wang
2026-08-18 22:56 ` Masami Hiramatsu
2026-08-07 15:34 ` [PATCH v12 06/11] selftests: tracing: Add a basic testcase for wprobe Masami Hiramatsu (Google)
2026-08-07 15:34 ` [PATCH v12 07/11] selftests: tracing: Add syntax " Masami Hiramatsu (Google)
2026-08-07 15:34 ` [PATCH v12 08/11] tracing/wprobe: Add set_wprobe and clear_wprobe event triggers Masami Hiramatsu (Google)
2026-08-07 15:54 ` sashiko-bot
2026-08-21 3:46 ` Masami Hiramatsu
2026-08-18 9:22 ` Jinchao Wang
2026-08-18 22:33 ` Masami Hiramatsu
2026-08-07 15:34 ` [PATCH v12 09/11] selftests: ftrace: Add wprobe trigger testcase Masami Hiramatsu (Google)
2026-08-07 15:53 ` sashiko-bot
2026-08-07 15:35 ` [PATCH v12 10/11] tracing/wprobe: Support BTF typecast in fetchargs Masami Hiramatsu (Google)
2026-08-07 15:35 ` [PATCH v12 11/11] tracing/wprobe: Support BTF struct offset resolution in set_wprobe trigger Masami Hiramatsu (Google)
2026-08-07 15:59 ` 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=20260820224334.faf2b4f78b383318748a8ff5@kernel.org \
--to=mhiramat@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-bot@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