diff mbox series

[7/7] parisc: Show kernel unaligned memory accesses

Message ID 20240123155904.6220-7-deller@kernel.org (mailing list archive)
State Superseded, archived
Headers show
Series [1/7] parisc: Use irq_enter_rcu() to fix warning at kernel/context_tracking.c:367 | expand

Commit Message

Helge Deller Jan. 23, 2024, 3:59 p.m. UTC
From: Helge Deller <deller@gmx.de>

Warn if some kernel function triggers unaligned memory accesses.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 arch/parisc/kernel/unaligned.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index c520e551a165..95a2741f26f3 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
@@ -399,6 +399,13 @@  void handle_unaligned(struct pt_regs *regs)
 
 		if (!unaligned_enabled)
 			goto force_sigbus;
+	} else {
+		static DEFINE_RATELIMIT_STATE(kernel_ratelimit, 5 * HZ, 5);
+		if (!(current->thread.flags & PARISC_UAC_NOPRINT) &&
+			__ratelimit(&kernel_ratelimit))
+			pr_warn("Kernel: unaligned access to " RFMT " in %pS "
+					"(iir " RFMT ")\n",
+				regs->ior, (void *)regs->iaoq[0], regs->iir);
 	}
 
 	/* handle modification - OK, it's ugly, see the instruction manual */