From: Sean Christopherson <seanjc@google.com>
To: Yu Zhang <yu.c.zhang@linux.intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+5feef0b9ee9c8e9e5689@syzkaller.appspotmail.com,
Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH 1/3] KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid
Date: Thu, 22 Jun 2023 14:32:53 -0700 [thread overview]
Message-ID: <ZJS+BdDFg+qd1SyA@google.com> (raw)
In-Reply-To: <20230622081953.jc4tw6cwczl7bc6j@linux.intel.com>
On Thu, Jun 22, 2023, Yu Zhang wrote:
> On Tue, Jun 13, 2023 at 01:30:35PM -0700, Sean Christopherson wrote:
> > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > index 0ecf4be2c6af..355b0e8c9b00 100644
> > --- a/arch/x86/kvm/vmx/vmx.c
> > +++ b/arch/x86/kvm/vmx/vmx.c
> > @@ -3037,6 +3037,15 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
> > struct vcpu_vmx *vmx = to_vmx(vcpu);
> > struct kvm_vmx *kvm_vmx = to_kvm_vmx(vcpu->kvm);
> >
> > + /*
> > + * KVM should never use VM86 to virtualize Real Mode when L2 is active,
> > + * as using VM86 is unnecessary if unrestricted guest is enabled, and
> > + * if unrestricted guest is disabled, VM-Enter (from L1) with CR0.PG=0
> > + * should VM-Fail and KVM should reject userspace attempts to stuff
>
> VM Enry shall fail(with CR0.PG=0), because SECONDARY_EXEC_UNRESTRICTED_GUEST
> will be cleared in L1's secondary_ctls_high MSR, and hence in its VMCS12?
Yep.
>
> When will an unrestricted L1 run L2 as a restricted one? Shadow on EPT(L0
> uses EPT for L1 and L1 uses shadow for L2)?
Ya, the L1 VMM/hypervisor disabling EPT is the most likely scenario, i.e. the only
thing I would expect to encounter outside of testing. Other than testing, e.g. to
ensure compatibility with Nehalem CPUs (the only Intel CPUs with EPT but not URG),
I don't know of any reason to disable URG but not EPT.
next prev parent reply other threads:[~2023-06-22 21:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 20:30 [PATCH 0/3] KVM: x86: CR0 vs. KVM_SET_SREGS and !URG Sean Christopherson
2023-06-13 20:30 ` [PATCH 1/3] KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid Sean Christopherson
2023-06-22 8:19 ` Yu Zhang
2023-06-22 21:32 ` Sean Christopherson [this message]
2023-06-13 20:30 ` [PATCH 2/3] KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest Sean Christopherson
2023-06-13 20:30 ` [PATCH 3/3] KVM: selftests: Expand x86's sregs test to cover illegal CR0 values Sean Christopherson
2023-07-29 15:04 ` [PATCH 0/3] KVM: x86: CR0 vs. KVM_SET_SREGS and !URG Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZJS+BdDFg+qd1SyA@google.com \
--to=seanjc@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=syzbot+5feef0b9ee9c8e9e5689@syzkaller.appspotmail.com \
--cc=yu.c.zhang@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox