aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Phillips <[email protected]>2022-06-14 23:15:44 +0200
committerBorislav Petkov <[email protected]>2022-06-27 10:33:58 +0200
commit0ee9073000e8791f8b134a8ded31bcc767f7f232 (patch)
tree44ad8925d2523a1dc64bc9b8c80171f00865158e
parent15583e514eb16744b80be85dea0774ece153177d (diff)
x86/sev: Avoid using __x86_return_thunk
Specifically, it's because __enc_copy() encrypts the kernel after being relocated outside the kernel in sme_encrypt_execute(), and the RET macro's jmp offset isn't amended prior to execution. Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Josh Poimboeuf <[email protected]> Signed-off-by: Borislav Petkov <[email protected]>
-rw-r--r--arch/x86/mm/mem_encrypt_boot.S8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/mm/mem_encrypt_boot.S b/arch/x86/mm/mem_encrypt_boot.S
index 3d1dba05fce4..d94dea450fa6 100644
--- a/arch/x86/mm/mem_encrypt_boot.S
+++ b/arch/x86/mm/mem_encrypt_boot.S
@@ -65,7 +65,9 @@ SYM_FUNC_START(sme_encrypt_execute)
movq %rbp, %rsp /* Restore original stack pointer */
pop %rbp
- RET
+ /* Offset to __x86_return_thunk would be wrong here */
+ ret
+ int3
SYM_FUNC_END(sme_encrypt_execute)
SYM_FUNC_START(__enc_copy)
@@ -151,6 +153,8 @@ SYM_FUNC_START(__enc_copy)
pop %r12
pop %r15
- RET
+ /* Offset to __x86_return_thunk would be wrong here */
+ ret
+ int3
.L__enc_copy_end:
SYM_FUNC_END(__enc_copy)