Alpha arch development list
 help / color / mirror / Atom feed
From: Matt Turner <mattst88@gmail.com>
To: linux-alpha@vger.kernel.org, richard.henderson@linaro.org
Cc: linmag7@gmail.com, linux-kernel@vger.kernel.org
Subject: [PATCH 18/24] alpha: select SYSCTL_EXCEPTION_TRACE
Date: Tue,  1 Sep 2026 11:50:31 -0400	[thread overview]
Message-ID: <ea0081603ea4f745e7c10895e83a1cfb4e80baaa.1788277742.git.mattst88@gmail.com> (raw)
In-Reply-To: <cover.1788277742.git.mattst88@gmail.com>

Report unhandled user faults the way other architectures do, and hook up
the debug.exception-trace sysctl that controls the reporting.

The message gives the faulting address, the PC and the user stack
pointer, and is rate limited.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Matt Turner <mattst88@gmail.com>
---
 arch/alpha/Kconfig    |  1 +
 arch/alpha/mm/fault.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git ./arch/alpha/Kconfig ./arch/alpha/Kconfig
index c4b4a9b8d770..4c60c442207c 100644
--- ./arch/alpha/Kconfig
+++ ./arch/alpha/Kconfig
@@ -59,6 +59,7 @@ config ALPHA
 	select MMU_GATHER_NO_RANGE
 	select MMU_GATHER_RCU_TABLE_FREE
 	select SPARSEMEM_EXTREME if SPARSEMEM
+	select SYSCTL_EXCEPTION_TRACE
 	select ZONE_DMA
 	select TRACE_IRQFLAGS_SUPPORT
 	select ARCH_WANT_FRAME_POINTERS
diff --git ./arch/alpha/mm/fault.c ./arch/alpha/mm/fault.c
index a9816bbc9f34..dfe427d93072 100644
--- ./arch/alpha/mm/fault.c
+++ ./arch/alpha/mm/fault.c
@@ -27,8 +27,32 @@
 #include <linux/uaccess.h>
 #include <linux/perf_event.h>
 
+#include <asm/pal.h>
+
 extern void die_if_kernel(char *,struct pt_regs *,long, unsigned long *);
 
+int show_unhandled_signals = 1;
+
+static void
+show_signal_msg(struct pt_regs *regs, unsigned long address, int signo,
+		const char *desc)
+{
+	const char *level;
+
+	if (!show_unhandled_signals || !unhandled_signal(current, signo))
+		return;
+	if (!printk_ratelimit())
+		return;
+
+	/* Losing init is fatal, so shout about it.  */
+	level = task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG;
+
+	printk("%s%s[%d]: %s at %016lx pc %016lx sp %016lx\n",
+	       level, current->comm, task_pid_nr(current), desc,
+	       address, regs->pc, rdusp());
+	print_vma_addr(KERN_CONT "  in ", regs->pc);
+	printk(KERN_CONT "\n");
+}
 
 /*
  * Force a new ASN for a task.
@@ -217,12 +241,17 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
 	mmap_read_unlock(mm);
 	/* Send a sigbus, regardless of whether we were in kernel
 	   or user mode.  */
+	if (user_mode(regs))
+		show_signal_msg(regs, address, SIGBUS, "bus error");
 	force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *) address);
 	if (!user_mode(regs))
 		goto no_context;
 	return;
 
  do_sigsegv:
+	show_signal_msg(regs, address, SIGSEGV,
+			si_code == SEGV_MAPERR ? "unmapped access"
+					       : "access violation");
 	force_sig_fault(SIGSEGV, si_code, (void __user *) address);
 	return;
 
-- 
2.54.0


  parent reply	other threads:[~2026-09-01 15:51 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 15:50 [PATCH 00/24] alpha: catch up on architecture Kconfig options Matt Turner
2026-09-01 15:50 ` [PATCH 01/24] alpha: fix arch_irqs_disabled_flags() to treat any raised IPL as disabled Matt Turner
2026-09-01 23:20   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 02/24] alpha: enter hardirq context before looking up the irq descriptor Matt Turner
2026-09-03 22:07   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 03/24] alpha: select ARCH_HAS_UBSAN Matt Turner
2026-09-01 22:34   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 04/24] alpha: select ARCH_HAS_GCOV_PROFILE_ALL Matt Turner
2026-09-03 22:35   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 05/24] alpha: select HAVE_DEBUG_KMEMLEAK Matt Turner
2026-09-02  6:01   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 06/24] alpha: select EDAC_SUPPORT Matt Turner
2026-09-01 23:17   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 07/24] alpha: select ARCH_SUPPORTS_ATOMIC_RMW Matt Turner
2026-09-02  6:17   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 08/24] alpha: select ARCH_HAS_FAST_MULTIPLIER Matt Turner
2026-09-02  7:49   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 09/24] alpha: select ARCH_SUPPORTS_INT128 Matt Turner
2026-09-02  8:50   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 10/24] alpha: select HAVE_ARCH_COMPILER_H Matt Turner
2026-09-02  9:11   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 11/24] alpha: select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE Matt Turner
2026-09-02  9:25   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 12/24] alpha: add HAVE_ARCH_THREAD_STRUCT_WHITELIST support Matt Turner
2026-09-02  9:35   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 13/24] alpha: add ARCH_HAS_PTE_SPECIAL support Matt Turner
2026-09-02  9:42   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 14/24] alpha: add ARCH_SUPPORTS_PAGE_TABLE_CHECK support Matt Turner
2026-09-01 22:45   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 15/24] alpha: select ARCH_HAS_DEBUG_VM_PGTABLE Matt Turner
2026-09-03 22:52   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 16/24] alpha: select HAVE_GUP_FAST Matt Turner
2026-09-02 21:09   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 17/24] alpha: select ARCH_USE_MEMTEST Matt Turner
2026-09-02 21:56   ` Magnus Lindholm
2026-09-01 15:50 ` Matt Turner [this message]
2026-09-02 22:02   ` [PATCH 18/24] alpha: select SYSCTL_EXCEPTION_TRACE Magnus Lindholm
2026-09-01 15:50 ` [PATCH 19/24] alpha: discard .eh_frame and the relocation sections Matt Turner
2026-09-03  5:18   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 20/24] alpha: select ARCH_WANT_LD_ORPHAN_WARN Matt Turner
2026-09-03  5:34   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 21/24] alpha: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM Matt Turner
2026-09-03  5:42   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 22/24] alpha: add HAVE_PERF_REGS and HAVE_PERF_USER_STACK_DUMP support Matt Turner
2026-09-03 21:01   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 23/24] alpha: select SPARSE_IRQ Matt Turner
2026-09-03 21:26   ` Magnus Lindholm
2026-09-01 15:50 ` [PATCH 24/24] alpha: add TRACE_IRQFLAGS_SUPPORT Matt Turner
2026-09-03 22:58   ` Magnus Lindholm
2026-09-02 18:53 ` [PATCH 00/24] alpha: catch up on architecture Kconfig options Magnus Lindholm
2026-09-02 18:57   ` Matt Turner

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=ea0081603ea4f745e7c10895e83a1cfb4e80baaa.1788277742.git.mattst88@gmail.com \
    --to=mattst88@gmail.com \
    --cc=linmag7@gmail.com \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.henderson@linaro.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