public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Roman Kagan <rkagan@virtuozzo.com>
To: Yang Zhang <yang.zhang.wz@gmail.com>
Cc: <kvm@vger.kernel.org>, Paolo Bonzini <pbonzini@redhat.com>,
	"Denis V. Lunev" <den@openvz.org>,
	Steve Rutherford <srutherford@google.com>
Subject: Re: [PATCH v2] kvm:vmx: more complete state update on APICv on/off
Date: Wed, 18 May 2016 11:37:09 +0300	[thread overview]
Message-ID: <20160518083709.GC13638@rkaganb.sw.ru> (raw)
In-Reply-To: <573BFCA2.6010907@gmail.com>

On Wed, May 18, 2016 at 01:24:50PM +0800, Yang Zhang wrote:
> On 2016/5/17 18:36, Roman Kagan wrote:
> 
> During reviewing this patch, I think there is an secure issue in upstream
> KVM since the 5c919412fe61c:
> 1. The enable_apicv is setting to 1 if the underling hardware has APICv
> capability.
> 2. set the x2apic_read/write msr to disable the interception for most x2apic
> read and TPR/EOI/SELF-IPI write.
> 3. vmx_set_virtual_x2apic_mode is called when guest enables the x2apic,but
> kvm_vcpu_apicv_active() check may fail if synIc is activated.This means the
> virtualize_x2apic_mode will not set even guest enabling the x2apic.
> 4. In the following vmx_set_msr_bitmap, it will use the x2apic msr bitmap
> without check whether virtualize_x2apic_mode is enabled and apicv is
> enabled.
> 5. Then the access to the msr that doesn't intercept by hypervisor will
> access the hardware directly.

Looks like a valid concern, thanks.

> > @@ -2418,7 +2418,8 @@ static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu)
> > 
> >   	if (is_guest_mode(vcpu))
> >   		msr_bitmap = vmx_msr_bitmap_nested;
> > -	else if (vcpu->arch.apic_base & X2APIC_ENABLE) {
> > +	else if (vcpu->arch.apic_base & X2APIC_ENABLE &&
> > +		 kvm_vcpu_apicv_active(vcpu)) {
> 
> Need to check the virtualize_x2apic_mode is enabled or not.

Indeed.  Have lost it while porting over from our branch; will resubmit.
Thanks!

Roman.

      reply	other threads:[~2016-05-18  8:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 10:36 [PATCH v2] kvm:vmx: more complete state update on APICv on/off Roman Kagan
2016-05-18  5:24 ` Yang Zhang
2016-05-18  8:37   ` Roman Kagan [this message]

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=20160518083709.GC13638@rkaganb.sw.ru \
    --to=rkagan@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=srutherford@google.com \
    --cc=yang.zhang.wz@gmail.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