linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <kernellwp@gmail.com>
To: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Radim Krcmar <rkrcmar@redhat.com>, kvm <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH v5 2/3] KVM: nVMX: Validate the IA32_BNDCFGS on nested VM-entry
Date: Fri, 3 Nov 2017 14:40:55 +0800	[thread overview]
Message-ID: <CANRm+Cyrx6=Zt-B7A29nJ4gm1e2a0e7ObNxJJCaWn29kH==EZw@mail.gmail.com> (raw)
In-Reply-To: <0b1d82f7-2fc6-9fc0-15a4-3500413814bd@oracle.com>

2017-11-03 14:31 GMT+08:00 Krish Sadhukhan <krish.sadhukhan@oracle.com>:
>
>
> On 11/02/2017 05:50 PM, Wanpeng Li wrote:
>>
>> From: Wanpeng Li <wanpeng.li@hotmail.com>
>>
>> According to the SDM, if the "load IA32_BNDCFGS" VM-entry controls is 1,
>> the
>> following checks are performed on the field for the IA32_BNDCFGS MSR:
>>   - Bits reserved in the IA32_BNDCFGS MSR must be 0.
>>   - The linear address in bits 63:12 must be canonical.
>>
>> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Radim Krčmář <rkrcmar@redhat.com>
>> Cc: Jim Mattson <jmattson@google.com>
>> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
>> ---
>> v3 -> v4:
>>   * simply condition
>>   * use && instead of nested "if"s
>>
>>   arch/x86/kvm/vmx.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index e6c8ffa..6cf3972 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -10805,6 +10805,11 @@ static int check_vmentry_postreqs(struct kvm_vcpu
>> *vcpu, struct vmcs12 *vmcs12,
>>                         return 1;
>>         }
>>   +     if (kvm_mpx_supported() &&
>> +               (is_noncanonical_address(vmcs12->guest_bndcfgs &
>> PAGE_MASK, vcpu) ||
>> +               (vmcs12->guest_bndcfgs & MSR_IA32_BNDCFGS_RSVD)))
>> +                       return 1;
>> +
>>         return 0;
>>   }
>>
>
> Hi Wanpeng,
>   The SDM check is performed only when "load IA32_BNDCFGS" VM-entry control
> is 1. But vmx_mpx_supported() returns true when both "load IA32_BNDCFGS" and
> "store IA32_BNDCFGS" VM-entry controls are 1. Therefore your check is
> performed when both controls are 1. Did I miss something here ?

https://lkml.org/lkml/2017/11/2/748 Paolo hopes the simplification.

Regards,
Wanpeng Li

  parent reply	other threads:[~2017-11-03  6:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03  0:50 [PATCH v5 1/3] KVM: X86: Fix operand/address-size during instruction decoding Wanpeng Li
2017-11-03  0:50 ` [PATCH v5 2/3] KVM: nVMX: Validate the IA32_BNDCFGS on nested VM-entry Wanpeng Li
     [not found]   ` <0b1d82f7-2fc6-9fc0-15a4-3500413814bd@oracle.com>
2017-11-03  6:40     ` Wanpeng Li [this message]
2017-11-03 17:13       ` Krish Sadhukhan
2017-11-03 17:54         ` Jim Mattson
2017-11-03  0:50 ` [PATCH v5 3/3] KVM: nVMX: Fix mmu context after VMLAUNCH/VMRESUME failure Wanpeng Li
2017-11-03 16:01   ` Jim Mattson
2017-11-04  0:07   ` Krish Sadhukhan
2017-11-08 21:47     ` Jim Mattson
2017-11-09  0:37       ` Wanpeng Li
2017-11-09 10:40         ` Paolo Bonzini
2017-11-09 10:47           ` Wanpeng Li
2017-11-09 11:05             ` Paolo Bonzini
2017-11-09 11:10               ` Wanpeng Li
2017-11-09 16:19           ` Jim Mattson
2018-02-05 18:44       ` Jim Mattson
2018-05-07 22:56         ` Jim Mattson

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='CANRm+Cyrx6=Zt-B7A29nJ4gm1e2a0e7ObNxJJCaWn29kH==EZw@mail.gmail.com' \
    --to=kernellwp@gmail.com \
    --cc=jmattson@google.com \
    --cc=krish.sadhukhan@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.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;
as well as URLs for NNTP newsgroup(s).