Re: [PATCH] KVM: x86: Mark transfer type as X86_TRANSFER_RET when loading CS in iret emulation

Sean Christopherson
2022-10-14T04:16:54Z

On Thu, Oct 13, 2022, Hou Wenlong wrote:
> On Thu, Oct 13, 2022 at 12:34:57AM +0800, Sean Christopherson wrote:
> > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> > index 3b27622d4642..fe735e18c419 100644
> > --- a/arch/x86/kvm/emulate.c
> > +++ b/arch/x86/kvm/emulate.c
> > @@ -1641,6 +1641,14 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
> > goto exception;
> > break;
> > case VCPU_SREG_CS:
> > + /*
> > + * KVM uses "none" when loading CS as part of emulating Real
> > + * Mode exceptions and IRET (handled above). In all other
> > + * cases, loading CS without a control transfer is a KVM bug.
> > + */
> > + if (WARN_ON_ONCE(transfer == X86_TRANSFER_NONE))
> > + goto exception;
> > +
> > if (!(seg_desc.type & 8))
> > goto exception;
> >
> Do I need to prepare this patch or you will add this directly?

No preference. Feel free to post a patch, if not I'll get to it soon-ish.