Skip to content

Commit 21ada69

Browse files
Jinjie Ruangregkh
authored andcommitted
riscv: Fix fp alignment bug in perf_callchain_user()
[ Upstream commit 22ab089 ] The standard RISC-V calling convention said: "The stack grows downward and the stack pointer is always kept 16-byte aligned". So perf_callchain_user() should check whether 16-byte aligned for fp. Link: https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf Fixes: dbeb90b ("riscv: Add perf callchain support") Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Cc: Björn Töpel <bjorn@kernel.org> Link: https://lore.kernel.org/r/20240708032847.2998158-2-ruanjinjie@huawei.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6eff336 commit 21ada69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/kernel/perf_callchain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void perf_callchain_user(struct perf_callchain_entry_ctx *entry,
6262
perf_callchain_store(entry, regs->epc);
6363

6464
fp = user_backtrace(entry, fp, regs->ra);
65-
while (fp && !(fp & 0x3) && entry->nr < entry->max_stack)
65+
while (fp && !(fp & 0x7) && entry->nr < entry->max_stack)
6666
fp = user_backtrace(entry, fp, 0);
6767
}
6868

0 commit comments

Comments
 (0)