Files
unkernel/kernel/patches/linux/kernel-Allow-arch-specific-panic-handling.patch
Pooya Parsa 25e0add13f kernel: fold the patch series and export it without churn
Fold the 56 kernel patches into 32: one arch patch (which now includes
the riscv ISA patch, parking, atomics, SMP, blocking waits, unfair
spinlocks, the arm64 user ABI, pc sampling, ptrace, single-step and core
dumps), each driver with its SMP part, the generic changes one per piece
(the cond_resched() poll split out of the arch patch), and kw_defconfig
last. The messages describe the code as it is; every patch that was
kernel-wasm@localhost's is Pooya Parsa's. The tree is unchanged.

kernel/build.sh patches (kernel/tools/export-patches.sh) exports the
series without what changed in every later patch on each edit: no
numbers in the file names (the order is the new series file, which
build.sh applies), a zero commit hash, no git version signature and no
index lines, with the diff options fixed.
2026-11-28 18:55:49 +00:00

63 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joel Severin <joel.severin@icemanor.se>
Date: Sun, 14 Sep 2025 17:03:25 +0200
Subject: [PATCH] kernel: Allow arch-specific panic handling
Debugging panics can be made much easier in hosted architectures (like
Wasm) if they can intercept panic() calls right when they happen.
---
include/asm-generic/Kbuild | 1 +
include/asm-generic/panic.h | 12 ++++++++++++
kernel/panic.c | 3 +++
3 files changed, 16 insertions(+)
create mode 100644 include/asm-generic/panic.h
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -42,6 +42,7 @@ mandatory-y += mmu_context.h
mandatory-y += module.h
mandatory-y += module.lds.h
mandatory-y += msi.h
+mandatory-y += panic.h
mandatory-y += pci.h
mandatory-y += percpu.h
mandatory-y += percpu_types.h
diff --git a/include/asm-generic/panic.h b/include/asm-generic/panic.h
new file mode 100644
--- /dev/null
+++ b/include/asm-generic/panic.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_GENERIC_PANIC_H
+#define _ASM_GENERIC_PANIC_H
+
+#ifndef CONFIG_ARCH_HAVE_PANIC_NOTIFY
+static inline void arch_panic_notify(const char *msg)
+{
+}
+#endif
+
+#endif /* _ASM_GENERIC_PANIC_H */
diff --git a/kernel/panic.c b/kernel/panic.c
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -38,6 +38,7 @@
#include <linux/seq_buf.h>
#include <linux/sys_info.h>
#include <trace/events/error_report.h>
+#include <asm/panic.h>
#include <asm/sections.h>
#include <kunit/test-bug.h>
@@ -721,6 +722,8 @@ void vpanic(const char *fmt, va_list args)
panic_console_replay)
console_flush_on_panic(CONSOLE_REPLAY_ALL);
+ arch_panic_notify(buf);
+
if (!panic_blink)
panic_blink = no_blink;