Skip to content

Commit 8f1534e

Browse files
xhackerustcpalmer-dabbelt
authored andcommitted
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]>
1 parent 7e340f4 commit 8f1534e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/riscv/kernel/entry.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ SYM_CODE_START(ret_from_fork)
326326
jalr s0
327327
1:
328328
move a0, sp /* pt_regs */
329-
la ra, ret_from_exception
330-
tail syscall_exit_to_user_mode
329+
call syscall_exit_to_user_mode
330+
j ret_from_exception
331331
SYM_CODE_END(ret_from_fork)
332332

333333
#ifdef CONFIG_IRQ_STACKS

0 commit comments

Comments
 (0)