[PW_SID:1094713] riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe#1933
[PW_SID:1094713] riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe#1933linux-riscv-bot wants to merge 1 commit into
Conversation
The fp_is_valid() function uses ALIGN(sp, THREAD_SIZE) as the upper bound for the frame pointer check. This bound is calculated relative to the current sp and shifts upward when sp itself exceeds the valid stack region, allowing the unwinder to read past the end of the allocated task stack and triggering KASAN stack-out-of-bounds. Fix this by using the absolute task stack boundary (task_stack_page(task) + THREAD_SIZE) instead. This ensures that once the frame pointer walks past the actual end of the stack, the check consistently fails and the unwinding terminates. Note that the frame pointer unwinder has no mechanism to detect when the unwind has crossed from the task stack onto a different kernel stack (e.g., IRQ stack). Using the absolute task stack boundary provides correct protection against out-of-bounds reads at the end of the task stack. Fixes: a2a4d4a ("riscv: stacktrace: fixed walk_stackframe()") Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn> Assisted-by: OpenClaw:DeepSeek-V3.2 Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
|
Patch 1: "riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe" |
PR for series 1094713 applied to workflow__riscv__fixes
Name: riscv: stacktrace: fix stack-out-of-bounds in walk_stackframe
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1094713
Version: 1