Skip to content

Commit 22ab089

Browse files
Jinjie Ruanpalmer-dabbelt
authored andcommitted
riscv: Fix fp alignment bug in perf_callchain_user()
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 <[email protected]> Cc: Björn Töpel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 8400291 commit 22ab089

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)