Commit 0ee90730 authored by Kim Phillips's avatar Kim Phillips Committed by Borislav Petkov
Browse files

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: default avatarKim Phillips <kim.phillips@amd.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
parent 15583e51
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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)