[PATCH 10/11] ARM: traps: Add handling for warnings to handle_bug_opcode()

Sebastian Andrzej Siewior sebastian at breakpoint.cc
Fri Oct 9 15:21:17 PDT 2026


Should a WARNing be encoded with a BUG opcode then it is needed to
forwarded the PC so the CPU can continue after the invalid opcode.

Signed-off-by: Sebastian Andrzej Siewior <sebastian at breakpoint.cc>
---
 arch/arm/kernel/traps.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 1353bf24da53f..12833307f9064 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -451,6 +451,14 @@ static int handle_bug_opcode(unsigned int instr, struct pt_regs *regs)
 	if (bug_type == BUG_TRAP_TYPE_NONE)
 		return 0;
 
+	if (bug_type == BUG_TRAP_TYPE_WARN) {
+		if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
+			regs->ARM_pc += 2;
+		else
+			regs->ARM_pc += 4;
+		return 1;
+	}
+
 	flags = oops_begin();
 	if (__die("Oops - BUG", 0, regs))
 		sig = 0;

-- 
2.55.0




More information about the linux-arm-kernel mailing list