Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1EB73F54C6; Sat, 12 Sep 2026 08:32:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789201969; cv=none; b=YD/E5jnGcDaknf/Cf6w7eARiDWdMbf6PQ2P/euHoPln0J7e1LCuuyeqOxEjHVUgWmG07h948R3HBX8TD/FkkWRjyS8fDcbAC1XrKXwAlEjDEwYVzTMbQ7IGNez7WWOCgFWNllWjt4WHQoR2B6IeLk1ZOBixrFldJHn0b+VC4MJo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789201969; c=relaxed/simple; bh=mwyczvFXFxigz7gZbc0i9avL4qMc28zhf5UoYqrf00M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LQpVuGpMqm5nbOtfkV30x0NwrFz0qgoIttJ0VpIA80s9h3MZXLU//8CQrA+kGCbLQzoQhLjFJ1KN4dyev0ETUh3dZyryPeHV9O04YdjNciuq2do53Z/5WgSPRBvjKSGYtfN2N8Ksv4Y0akSZqeVHE3wvKld4opWKCn8Ke6WQRjo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sTGp1kdH; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="sTGp1kdH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 529341F000FF; Sat, 12 Sep 2026 08:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789201965; bh=xJR1LpQRNzKrR8aAf4n7xKCXYQdK6ASzqYHwlFDUOGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sTGp1kdHvVEtRxaxWMzvmy0gKpw0oj6BJ4FXob0OJ4pC9mA5saOs5Y1/ngxt4qep2 VFkm5A/YqEC/jUg5qEKL6rN5QeoRMjIy2FN7HA9V7kLdzDIspGfSOU9lDLGTtu6m8a PpncFSc6vysImQR9GVv12ySi/ZdVp/bBvC9C5lYw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, slipher , Mark Rutland , Linus Walleij , Russell King , Sasha Levin Subject: [PATCH 7.2 1106/1815] ARM: 9481/2: breakpoint: CFI breakpoints only on demand Date: Sat, 12 Sep 2026 08:47:36 +0200 Message-ID: <20260912065714.984065290@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065648.999753832@linuxfoundation.org> References: <20260912065648.999753832@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linus Walleij [ Upstream commit 8ed9bff906cf8036531d1559f10e82733a52b41f ] This removes the stub hw_breakpoint_cfi_handler() from ARM, making it not steal breakpoint type 0x03 (ARM_ENTRY_CFI_BREAKPOINT) unless CFI is actively used in the kernel. When not instrumenting with CFI, or when a breakpoint is issued in userspace, we fall through to return 1 from hw_breakpoint_pending() "unhandled fault" so userspace can make use of this breakpoint. Tested with LKDTM and this command line: echo CFI_FORWARD_PROTO > /sys/kernel/debug/provoke-crash/DIRECT still works as expected. Closes: https://lore.kernel.org/lkml/kJqktbpLphg_Pk5I5SPptgTLjl3E3eq5mN5UzCslyFj7Q1Irp-wDid4mj5eQVd2iZtRGXgeZd8goq195EkXdjyt864YMc8mVb2B9NGH91NQ=@protonmail.com/ Fixes: c3f89986fde7 ("ARM: 9391/2: hw_breakpoint: Handle CFI breakpoints") Reported-by: slipher Suggested-by: Mark Rutland Signed-off-by: Linus Walleij Signed-off-by: Russell King Signed-off-by: Sasha Levin --- arch/arm/kernel/hw_breakpoint.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index cd4b34c96e35e..38feb30dfb5f8 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c @@ -929,10 +929,6 @@ static void hw_breakpoint_cfi_handler(struct pt_regs *regs) break; } } -#else -static void hw_breakpoint_cfi_handler(struct pt_regs *regs) -{ -} #endif /* @@ -964,9 +960,14 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr, case ARM_ENTRY_SYNC_WATCHPOINT: watchpoint_handler(addr, fsr, regs); break; +#ifdef CONFIG_CFI case ARM_ENTRY_CFI_BREAKPOINT: - hw_breakpoint_cfi_handler(regs); + if (user_mode(regs)) + ret = 1; /* Don't handle userspace BKPT */ + else + hw_breakpoint_cfi_handler(regs); break; +#endif default: ret = 1; /* Unhandled fault. */ } -- 2.53.0