Skip to contentSkip to conversation

riscv: avoid Imbalance in RAS

PATCH Applied Jisheng Zhang 2 participants 2 messages Jul 20, 2024 – Sep 17, 2024 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---

since v1:
- make it a seperate patch
- modify the commit msg, thank Deepak
- collect Reviewed-by tag

 arch/riscv/kernel/entry.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/entry.S +2 -2
index c933460ed3e9..81dec627a8d4 100644
@@ -235,8 +235,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
Signature · 1 line
2.43.0
#1 lore raw
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Quoted 9 lines · On Sun, 21 Jul 2024 01:06:59 +0800 you wrote:

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.

[...]

Here is the summary with links:
- [v2] riscv: avoid Imbalance in RAS

    https://git.kernel.org/riscv/c/8f1534e74403

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html