linux/arch/riscv
Chen Huang f766f77a74
riscv/stacktrace: Fix stack output without ra on the stack top
When a function doesn't have a callee, then it will not
push ra into the stack, such as lkdtm_BUG() function,

addi	sp,sp,-16
sd	s0,8(sp)
addi	s0,sp,16
ebreak

The struct stackframe use {fp,ra} to get information from
stack, if walk_stackframe() with pr_regs, we will obtain
wrong value and bad stacktrace,

[<ffffffe00066c56c>] lkdtm_BUG+0x6/0x8
---[ end trace 18da3fbdf08e25d5 ]---

Correct the next fp and pc, after that, full stacktrace
shown as expects,

[<ffffffe00066c56c>] lkdtm_BUG+0x6/0x8
[<ffffffe0008b24a4>] lkdtm_do_action+0x14/0x1c
[<ffffffe00066c372>] direct_entry+0xc0/0x10a
[<ffffffe000439f86>] full_proxy_write+0x42/0x6a
[<ffffffe000309626>] vfs_write+0x7e/0x214
[<ffffffe00030992a>] ksys_write+0x98/0xc0
[<ffffffe000309960>] sys_write+0xe/0x16
[<ffffffe0002014bc>] ret_from_syscall+0x0/0x2
---[ end trace 61917f3d9a9fadcd ]---

Signed-off-by: Chen Huang <chenhuang5@huawei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
2021-01-14 15:09:13 -08:00
..
boot riscv: Fix Canaan Kendryte K210 device tree 2021-01-14 15:08:47 -08:00
configs riscv: Use vendor name for K210 SoC support 2021-01-14 15:08:46 -08:00
include riscv: Add dump stack in show_regs 2021-01-14 15:09:11 -08:00
kernel riscv/stacktrace: Fix stack output without ra on the stack top 2021-01-14 15:09:13 -08:00
lib riscv: Add support for function error injection 2021-01-14 15:09:09 -08:00
mm riscv: Add uprobes supported 2021-01-14 15:09:08 -08:00
net treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
Kbuild riscv: Allow device trees to be built into the kernel 2020-05-18 11:38:05 -07:00
Kconfig riscv: Enable per-task stack canaries 2021-01-14 15:09:10 -08:00
Kconfig.debug
Kconfig.socs riscv: Add Canaan Kendryte K210 reset controller 2021-01-14 15:08:53 -08:00
Makefile riscv: Enable per-task stack canaries 2021-01-14 15:09:10 -08:00