From: sashiko-bot@kernel.org
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v7 07/10] x86/hw_breakpoint: Add arch_reinstall_hw_breakpoint
Date: Wed, 15 Jul 2026 02:13:37 +0000 [thread overview]
Message-ID: <20260715021337.E9D0F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <178407992003.95826.8437044383333615344.stgit@devnote2>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] arch_reinstall_hw_breakpoint() fails to clear old DR7 length and type bits before applying new attributes, causing hardware state corruption if breakpoint parameters are modified.
--
--- Patch [7]: [PATCH v7 07/10] x86/hw_breakpoint: Add arch_reinstall_hw_breakpoint ---
commit 6bcf7b8e474f5683afc4564b0a92754b65b43406
Author: Jinchao Wang <wangjinchao600@gmail.com>
x86/hw_breakpoint: Add arch_reinstall_hw_breakpoint
This commit introduces arch_reinstall_hw_breakpoint() to allow callers to
efficiently re-establish existing hardware breakpoints in an atomic context
without needing the full free and re-allocation path.
> diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
> index 877509539300c..9af8d81075db7 100644
> --- a/arch/x86/kernel/hw_breakpoint.c
> +++ b/arch/x86/kernel/hw_breakpoint.c
[ ... ]
> @@ -188,6 +192,11 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
> return arch_manage_bp(bp, BP_SLOT_ACTION_INSTALL);
> }
>
> +int arch_reinstall_hw_breakpoint(struct perf_event *bp)
> +{
> + return arch_manage_bp(bp, BP_SLOT_ACTION_REINSTALL);
> +}
[Severity: Medium]
When callers use this new function to update an existing breakpoint's length
or type attributes, will this cause hardware state corruption in the DR7
control register?
The execution path goes through arch_manage_bp() and calls setup_hwbp()
with enable = true. Looking at setup_hwbp(), it appears the new control bits
are bitwise OR'ed with the existing mask:
arch/x86/kernel/hw_breakpoint.c:setup_hwbp() {
...
if (enable)
dr7 |= encode_dr7(slot, info->len, info->type);
...
}
Because the old DR7 configuration bits for this slot are never cleared first,
could the combination of old and new bits create an invalid breakpoint
configuration mask?
--
Sashiko AI review · https://sashiko.dev/#/patchset/178407983818.95826.12714571928538799781.stgit@devnote2?part=7
next prev parent reply other threads:[~2026-07-15 2:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 1:43 [PATCH v7 00/10] tracing: wprobe: x86: Add wprobe for watchpoint Masami Hiramatsu (Google)
2026-07-15 1:44 ` [PATCH v7 01/10] tracing: wprobe: Add watchpoint probe event based on hardware breakpoint Masami Hiramatsu (Google)
2026-07-15 2:01 ` sashiko-bot
2026-07-15 1:44 ` [PATCH v7 02/10] x86: hw_breakpoint: Add a kconfig to clarify when a breakpoint fires Masami Hiramatsu (Google)
2026-07-15 1:57 ` sashiko-bot
2026-07-15 1:44 ` [PATCH v7 03/10] selftests: tracing: Add a basic testcase for wprobe Masami Hiramatsu (Google)
2026-07-15 1:52 ` sashiko-bot
2026-07-15 1:44 ` [PATCH v7 04/10] selftests: tracing: Add syntax " Masami Hiramatsu (Google)
2026-07-15 1:44 ` [PATCH v7 05/10] tracing: wprobe: Use a new seq_print_ip_sym_offset() wrapper Masami Hiramatsu (Google)
2026-07-15 2:02 ` sashiko-bot
2026-07-15 1:45 ` [PATCH v7 06/10] x86/hw_breakpoint: Unify breakpoint install/uninstall Masami Hiramatsu (Google)
2026-07-15 1:59 ` sashiko-bot
2026-07-15 1:45 ` [PATCH v7 07/10] x86/hw_breakpoint: Add arch_reinstall_hw_breakpoint Masami Hiramatsu (Google)
2026-07-15 2:13 ` sashiko-bot [this message]
2026-07-15 1:45 ` [PATCH v7 08/10] HWBP: Add modify_wide_hw_breakpoint_local() API Masami Hiramatsu (Google)
2026-07-15 2:00 ` sashiko-bot
2026-07-15 1:45 ` [PATCH v7 09/10] tracing: wprobe: Add wprobe event trigger Masami Hiramatsu (Google)
2026-07-15 2:05 ` sashiko-bot
2026-07-15 1:45 ` [PATCH v7 10/10] selftests: ftrace: Add wprobe trigger testcase Masami Hiramatsu (Google)
2026-07-15 2:16 ` 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=20260715021337.E9D0F1F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.