Skip to content

Commit 28f18cb

Browse files
committed
riscv: s64ilp32: Correct the rv64ilp32 stackframe layout
The callee saved fp & ra are xlen size, not long size. This patch corrects the layout for the struct stackframe. echo c > /proc/sysrq-trigger Before the patch: sysrq: Trigger a crash Kernel panic - not syncing: sysrq triggered crash CPU: 0 PID: 102 Comm: sh Not tainted 6.3.0-rc1-00084-g9e2ba938797e-dirty #2 Hardware name: riscv-virtio,qemu (DT) Call Trace: ---[ end Kernel panic - not syncing: sysrq triggered crash ]--- After the patch: sysrq: Trigger a crash Kernel panic - not syncing: sysrq triggered crash CPU: 0 PID: 102 Comm: sh Not tainted 6.3.0-rc1-00084-g9e2ba938797e-dirty #1 Hardware name: riscv-virtio,qemu (DT) Call Trace: [<c00050c8>] dump_backtrace+0x1e/0x26 [<c086dcae>] show_stack+0x2e/0x3c [<c0878e00>] dump_stack_lvl+0x40/0x5a [<c0878e30>] dump_stack+0x16/0x1e [<c086df7c>] panic+0x10c/0x2a8 [<c04f4c1e>] sysrq_reset_seq_param_set+0x0/0x76 [<c04f52cc>] __handle_sysrq+0x9c/0x19c [<c04f5946>] write_sysrq_trigger+0x64/0x78 [<c020c7f6>] proc_reg_write+0x4a/0xa2 [<c01acf0a>] vfs_write+0xac/0x308 [<c01ad2b8>] ksys_write+0x62/0xda [<c01ad33e>] sys_write+0xe/0x16 [<c0879860>] do_trap_ecall_u+0xd8/0xda [<c00037de>] ret_from_exception+0x0/0x66 ---[ end Kernel panic - not syncing: sysrq triggered crash ]--- Signed-off-by: Guo Ren <[email protected]> Signed-off-by: Guo Ren <[email protected]>
1 parent b1b30b7 commit 28f18cb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/riscv/include/asm/stacktrace.h

+6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88

99
struct stackframe {
1010
unsigned long fp;
11+
#ifdef CONFIG_ARCH_RV64ILP32
12+
unsigned long pad1;
13+
#endif
1114
unsigned long ra;
15+
#ifdef CONFIG_ARCH_RV64ILP32
16+
unsigned long pad2;
17+
#endif
1218
};
1319

1420
extern void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,

0 commit comments

Comments
 (0)