RSB-stuffing after VM-exit is only needed for legacy CPUs without eIBRS. Move the RSB-stuffing code out of line. Preserve the non-sensical correlation of RSB-stuffing with retpoline. Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx> --- arch/x86/kvm/vmx/vmenter.S | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S index 435c187927c4..39009a4c86bd 100644 --- a/arch/x86/kvm/vmx/vmenter.S +++ b/arch/x86/kvm/vmx/vmenter.S @@ -76,7 +76,12 @@ SYM_FUNC_END(vmx_vmenter) */ SYM_FUNC_START(vmx_vmexit) #ifdef CONFIG_RETPOLINE - ALTERNATIVE "jmp .Lvmexit_skip_rsb", "", X86_FEATURE_RETPOLINE + ALTERNATIVE "", "jmp .Lvmexit_stuff_rsb", X86_FEATURE_RETPOLINE +#endif +.Lvmexit_return: + RET +#ifdef CONFIG_RETPOLINE +.Lvmexit_stuff_rsb: /* Preserve guest's RAX, it's used to stuff the RSB. */ push %_ASM_AX @@ -87,9 +92,8 @@ SYM_FUNC_START(vmx_vmexit) or $1, %_ASM_AX pop %_ASM_AX -.Lvmexit_skip_rsb: + jmp .Lvmexit_return #endif - RET SYM_FUNC_END(vmx_vmexit) /** -- 2.37.0.rc0.104.g0611611a94-goog