Linux-parisc archive mirror
 help / color / mirror / Atom feed
From: deller@kernel.org
To: linux-parisc@vger.kernel.org
Subject: [PATCH 7/7] parisc: Show kernel unaligned memory accesses
Date: Tue, 23 Jan 2024 16:59:04 +0100	[thread overview]
Message-ID: <20240123155904.6220-7-deller@kernel.org> (raw)
In-Reply-To: <20240123155904.6220-1-deller@kernel.org>

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 --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 */
-- 
2.43.0


      parent reply	other threads:[~2024-01-23 15:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 15:58 [PATCH 1/7] parisc: Use irq_enter_rcu() to fix warning at kernel/context_tracking.c:367 deller
2024-01-23 15:58 ` [PATCH 2/7] parisc: Make RO_DATA page aligned in vmlinux.lds.S deller
2024-01-23 15:59 ` [PATCH 3/7] parisc: Check for valid stride size for cache flushes deller
2024-01-23 15:59 ` [PATCH 4/7] parisc: Prevent hung tasks when printing inventory on serial console deller
2024-01-23 15:59 ` [PATCH 5/7] parisc: Drop unneeded semicolon in parse_tree_node() deller
2024-01-23 15:59 ` [PATCH 6/7] parisc: Fix random data corruption from exception handler deller
2024-01-23 15:59 ` deller [this message]

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=20240123155904.6220-7-deller@kernel.org \
    --to=deller@kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).