Skip to content

Commit 0ee9073

Browse files
kimphillamdsuryasaimadhu
authored andcommitted
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]>
1 parent 15583e5 commit 0ee9073

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arch/x86/mm/mem_encrypt_boot.S

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ SYM_FUNC_START(sme_encrypt_execute)
6565
movq %rbp, %rsp /* Restore original stack pointer */
6666
pop %rbp
6767

68-
RET
68+
/* Offset to __x86_return_thunk would be wrong here */
69+
ret
70+
int3
6971
SYM_FUNC_END(sme_encrypt_execute)
7072

7173
SYM_FUNC_START(__enc_copy)
@@ -151,6 +153,8 @@ SYM_FUNC_START(__enc_copy)
151153
pop %r12
152154
pop %r15
153155

154-
RET
156+
/* Offset to __x86_return_thunk would be wrong here */
157+
ret
158+
int3
155159
.L__enc_copy_end:
156160
SYM_FUNC_END(__enc_copy)

0 commit comments

Comments
 (0)