Skip to content

Commit

Permalink
x86/sev: Avoid using __x86_return_thunk
Browse files Browse the repository at this point in the history
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 <kim.phillips@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
  • Loading branch information
kimphillamd authored and suryasaimadhu committed Jun 27, 2022
1 parent 15583e5 commit 0ee9073
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions arch/x86/mm/mem_encrypt_boot.S
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

0 comments on commit 0ee9073

Please sign in to comment.