[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aVwgmMlOjL1UXvOL@willie-the-truck>
Date: Mon, 5 Jan 2026 20:35:36 +0000
From: Will Deacon <will@...nel.org>
To: Osama Abdelkader <osama.abdelkader@...il.com>
Cc: Mark Rutland <mark.rutland@....com>,
Catalin Marinas <catalin.marinas@....com>,
linux-arm-kernel@...ts.infradead.org,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] arm64: hw_breakpoint: warn on invalid breakpoint
length
On Sat, Dec 13, 2025 at 12:23:35PM +0100, Osama Abdelkader wrote:
> Some tools (e.g. perf) incorrectly assume that breakpoints should be
> sizeof(long), but this is wrong for AArch64 where breakpoints must be
> 4 bytes. Add a warning when we silently fix up the parameter so tool
> developers can get notified.
>
> This addresses the FIXME comment by adding diagnostic output rather
> than breaking existing tools by returning -EINVAL.
>
> Signed-off-by: Osama Abdelkader <osama.abdelkader@...il.com>
> ---
> v2: fix warning messageline splitting
> ---
> arch/arm64/kernel/hw_breakpoint.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
> index ab76b36dce82..cce306145d78 100644
> --- a/arch/arm64/kernel/hw_breakpoint.c
> +++ b/arch/arm64/kernel/hw_breakpoint.c
> @@ -475,11 +475,13 @@ static int arch_build_bp_info(struct perf_event *bp,
> return -EINVAL;
> } else if (hw->ctrl.len != ARM_BREAKPOINT_LEN_4) {
> /*
> - * FIXME: Some tools (I'm looking at you perf) assume
> - * that breakpoints should be sizeof(long). This
> - * is nonsense. For now, we fix up the parameter
> - * but we should probably return -EINVAL instead.
> + * Some tools (e.g. perf) incorrectly assume that
> + * breakpoints should be sizeof(long). This is wrong
> + * for AArch64 where breakpoints must be 4 bytes.
> + * Warn the user and fix up the parameter.
> */
> + pr_warn_once("hw_breakpoint: invalid AArch64 breakpoint length %d, fixing to 4 bytes\n",
> + hw->ctrl.len);
> hw->ctrl.len = ARM_BREAKPOINT_LEN_4;
This is user triggerable so I don't see why printing a message is a good
idea. Just remove the FIXME tag if it bothers you -- we can't really
change the behaviour at this point.
Will
Powered by blists - more mailing lists