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/20240607061335.2197383-1-cyrilbur@tenstorrent.com/ [1] Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Reviewed-by: Cyril Bur <cyrilbur@tenstorrent.com> Link: https://lore.kernel.org/r/20240720170659.1522-1-jszhang@kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 7e340f4 commit 8f1534e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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)