aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJisheng Zhang <[email protected]>2024-07-21 01:06:59 +0800
committerPalmer Dabbelt <[email protected]>2024-09-15 20:58:25 -0700
commit8f1534e7440382d118c3d655d3a6014128b2086d (patch)
tree125343c989be1ae407db466d0e9ca5edd5f4eff9
parent7e340f4fad46b766705be96f5d1c764a397a7a36 (diff)
riscv: avoid Imbalance in RAS
Inspired by[1], modify the code to remove the code of modifying ra to avoid imbalance RAS (return address stack) which may lead to incorret predictions on return. Link: https://lore.kernel.org/linux-riscv/[email protected]/ [1] Signed-off-by: Jisheng Zhang <[email protected]> Reviewed-by: Cyril Bur <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
-rw-r--r--arch/riscv/kernel/entry.S4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index fc41472d512e..c200d329d4bd 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -326,8 +326,8 @@ SYM_CODE_START(ret_from_fork)
jalr s0
1:
move a0, sp /* pt_regs */
- la ra, ret_from_exception
- tail syscall_exit_to_user_mode
+ call syscall_exit_to_user_mode
+ j ret_from_exception
SYM_CODE_END(ret_from_fork)
#ifdef CONFIG_IRQ_STACKS