From: sashiko-bot@kernel.org
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v8 7/9] HWBP: Add modify_wide_hw_breakpoint_local() API
Date: Thu, 16 Jul 2026 03:08:56 +0000 [thread overview]
Message-ID: <20260716030857.2E06A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <178417041407.209165.16286991487015275181.stgit@devnote2>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] State Corruption on Error Path
- [High] Race Condition / Unprotected State Modification with NMI
- [Medium] Locking Context / Lockdep Splat Due to Missing IRQ Disabling
--
--- Patch [7]: [PATCH v8 7/9] HWBP: Add modify_wide_hw_breakpoint_local() API ---
commit 12f28341e1b86eda783641bab63a14b074ec1ca3
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Subject: HWBP: Add modify_wide_hw_breakpoint_local() API
This patch adds an architecture-wide interface to allow hardware breakpoint
users to update watch addresses online. It supports modifying compatible
breakpoint types without releasing and reserving the hardware slot.
> diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
> --- a/kernel/events/hw_breakpoint.c
> +++ b/kernel/events/hw_breakpoint.c
[ ... ]
> @@ -888,6 +888,49 @@ void unregister_wide_hw_breakpoint(struct perf_event * __percpu *cpu_events)
[ ... ]
> +#ifdef CONFIG_HAVE_REINSTALL_HW_BREAKPOINT
> +int modify_wide_hw_breakpoint_local(struct perf_event *bp,
> + struct perf_event_attr *attr)
> +{
> + struct arch_hw_breakpoint info;
> + int ret;
> +
> + if (find_slot_idx(bp->attr.bp_type) != find_slot_idx(attr->bp_type))
> + return -EINVAL;
> +
> + ret = hw_breakpoint_arch_parse(bp, attr, &info);
> + if (ret)
> + return ret;
> +
> + *counter_arch_bp(bp) = info;
> + bp->attr.bp_addr = attr->bp_addr;
> + bp->attr.bp_type = attr->bp_type;
> + bp->attr.bp_len = attr->bp_len;
[Severity: High]
Is it safe to modify these software attributes non-atomically while the
hardware breakpoint is still fully enabled?
If a concurrent hardware debug exception fires and acts as a non-maskable
interrupt during this modification, could the exception handler read partially
updated or torn attributes and report incorrect trace data?
> +
> + return arch_reinstall_hw_breakpoint(bp);
[Severity: High]
If arch_reinstall_hw_breakpoint() fails, this returns the error code directly,
but the internal state of the event has already been permanently modified.
Could this leave the breakpoint object in an inconsistent state where the
caller receives an error but the object was mutated?
Should we restore the original state if the architecture update fails?
[Severity: Medium]
Do callers of modify_wide_hw_breakpoint_local() need to have interrupts
disabled?
Calling arch_reinstall_hw_breakpoint() on x86 eventually reaches
arch_manage_bp(), which contains an unconditional
lockdep_assert_irqs_disabled():
modify_wide_hw_breakpoint_local()
arch_reinstall_hw_breakpoint()
arch_manage_bp()
lockdep_assert_irqs_disabled()
Since this exported function doesn't disable interrupts itself or document
the requirement, will callers from standard contexts trigger a lockdep splat?
> +}
> +#else
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/178417033089.209165.16717079876036408877.stgit@devnote2?part=7
next prev parent reply other threads:[~2026-07-16 3:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 2:52 [PATCH v8 0/9] tracing: wprobe: x86: Add wprobe for watchpoint Masami Hiramatsu (Google)
2026-07-16 2:52 ` [PATCH v8 1/9] tracing: wprobe: Add watchpoint probe event based on hardware breakpoint Masami Hiramatsu (Google)
2026-07-16 3:13 ` sashiko-bot
2026-07-16 2:52 ` [PATCH v8 2/9] x86: hw_breakpoint: Add a kconfig to clarify when a breakpoint fires Masami Hiramatsu (Google)
2026-07-16 2:52 ` [PATCH v8 3/9] selftests: tracing: Add a basic testcase for wprobe Masami Hiramatsu (Google)
2026-07-16 3:05 ` sashiko-bot
2026-07-16 2:52 ` [PATCH v8 4/9] selftests: tracing: Add syntax " Masami Hiramatsu (Google)
2026-07-16 2:53 ` [PATCH v8 5/9] x86/hw_breakpoint: Unify breakpoint install/uninstall Masami Hiramatsu (Google)
2026-07-16 2:53 ` [PATCH v8 6/9] x86/hw_breakpoint: Add arch_reinstall_hw_breakpoint Masami Hiramatsu (Google)
2026-07-16 3:08 ` sashiko-bot
2026-07-16 2:53 ` [PATCH v8 7/9] HWBP: Add modify_wide_hw_breakpoint_local() API Masami Hiramatsu (Google)
2026-07-16 3:08 ` sashiko-bot [this message]
2026-07-16 2:53 ` [PATCH v8 8/9] tracing: wprobe: Add wprobe event trigger Masami Hiramatsu (Google)
2026-07-16 3:12 ` sashiko-bot
2026-07-16 2:53 ` [PATCH v8 9/9] selftests: ftrace: Add wprobe trigger testcase Masami Hiramatsu (Google)
2026-07-16 3:12 ` 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=20260716030857.2E06A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@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