Re: [PATCH] x86/retpoline: Don't clobber RFLAGS during srso_safe_ret()

From: Sean Christopherson
Date: Fri Aug 11 2023 - 22:57:29 EST


On Fri, Aug 11, 2023, Mika Penttilä wrote:
> > @@ -252,11 +252,10 @@ SYM_START(srso_untrain_ret, SYM_L_GLOBAL, SYM_A_NONE)
> > .byte 0x48, 0xb8
> > SYM_INNER_LABEL(srso_safe_ret, SYM_L_GLOBAL)
> > - add $8, %_ASM_SP
> > + lea 8(%_ASM_SP), %_ASM_SP
> > ret
> > int3
> > int3
> > - int3
> > lfence
> > call srso_safe_ret
> > int3
> >
> > base-commit: 25aa0bebba72b318e71fe205bfd1236550cc9534
>
> Don't we have the same kind of problems with __x86_return_skl ?

Yep, forcing that path via "retbleed=force retbleed=stuff spectre_v2=retpoline,generic"
yields the same failures. I have no idea how to go about cleanly fixing that.
The logic effectively requires modifying flags, the only thing I can think of is
to save/restore flags across the thunk, which seems beyond gross.

Given that no one has complained about this, I think I'd vote to simply disable
KVM if call depth tracking is being used.