From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: sashiko-bot@kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v12 04/11] tracing/wprobe: Add wprobe (watchpoint probe) trace event support
Date: Fri, 21 Aug 2026 09:21:52 +0900 [thread overview]
Message-ID: <20260821092152.7277764586f275edcd7bf09d@kernel.org> (raw)
In-Reply-To: <20260807155914.DDAD21F000E9@smtp.kernel.org>
On Fri, 07 Aug 2026 15:59:14 +0000
sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Hardware breakpoints are not synchronized with module unloads, leading to dangling breakpoints on reallocated memory.
> --
>
> --- Patch [4]: [PATCH v12 04/11] tracing/wprobe: Add wprobe (watchpoint probe) trace event support ---
> commit 6f99af1ed7b9527ff7af700fbd99ed2a3d0632d9
> Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> tracing/wprobe: Add wprobe (watchpoint probe) trace event support
>
> This commit adds wprobe, a hardware-breakpoint-based dynamic trace event.
> It allows users to monitor memory accesses by setting hardware breakpoints
> on specified addresses or symbols and logging the access context.
>
> Link: https://lore.kernel.org/all/59637b96946653393a7ad3c7de094094796b39c2.1785067572.git.wangjinchao600@gmail.com/
>
> > diff --git a/kernel/trace/trace_wprobe.c b/kernel/trace/trace_wprobe.c
> > new file mode 100644
> > index 0000000000000..df592d9280a47
> > --- /dev/null
> > +++ b/kernel/trace/trace_wprobe.c
> [ ... ]
> > +static int __register_trace_wprobe(struct trace_wprobe *tw)
> > +{
> > + struct perf_event_attr attr;
> > + int i, ret;
> [ ... ]
> > + hw_breakpoint_init(&attr);
> > + attr.bp_addr = tw->addr;
> > + attr.bp_len = tw->len;
> > + attr.bp_type = tw->type;
> > +
> > + tw->bp_event = register_wide_hw_breakpoint(&attr, wprobe_perf_handler, tw);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> [Severity: Medium]
> When a watchpoint probe is created for a module symbol, does this leave a
> dangling hardware breakpoint if the module is later unloaded?
>
> Since the wprobe subsystem doesn't seem to register a module notifier
> (unlike kprobes) to clean up when modules are unloaded, the breakpoint stays
> active on the raw virtual address. If that memory is freed and subsequently
> reallocated for a different module or vmalloc allocation, could this lead
> to spurious trace events and unintended performance overhead on the reused
> memory?
Yeah, but this wprobe is for debugging feature, so it will be used for
tracking UAF too. Thus I would like to keep this as it is now.
We can add module symbol support (e.g. :mod:sym instead of sym) but that
should be done as a different improvement.
Thanks,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2026-08-21 0:21 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
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 [this message]
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=20260821092152.7277764586f275edcd7bf09d@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