public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yang Zhang <yang.zhang.wz@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: VMX: fix read/write sizes of VMCS fields
Date: Fri, 4 Dec 2015 10:05:14 +0800	[thread overview]
Message-ID: <5660F4DA.7020604@gmail.com> (raw)
In-Reply-To: <1449155516-46735-1-git-send-email-pbonzini@redhat.com>

On 2015/12/3 23:11, Paolo Bonzini wrote:
> In theory this should have broken EPT on 32-bit kernels (due to
> reading the high part of natural-width field GUEST_CR3).  Not sure
> if no one noticed or the processor behaves differently from the
> documentation.

It seems we will check the success of vmcs_write but not vmcs_read. 
Shouldn't check the vmcs_read?

>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   arch/x86/kvm/vmx.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index c39737ff0581..b1af1e48070b 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -4868,7 +4868,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
>
>   	seg_setup(VCPU_SREG_CS);
>   	vmcs_write16(GUEST_CS_SELECTOR, 0xf000);
> -	vmcs_write32(GUEST_CS_BASE, 0xffff0000);
> +	vmcs_writel(GUEST_CS_BASE, 0xffff0000ul);
>
>   	seg_setup(VCPU_SREG_DS);
>   	seg_setup(VCPU_SREG_ES);
> @@ -4904,7 +4904,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
>
>   	vmcs_write32(GUEST_ACTIVITY_STATE, GUEST_ACTIVITY_ACTIVE);
>   	vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, 0);
> -	vmcs_write32(GUEST_PENDING_DBG_EXCEPTIONS, 0);
> +	vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, 0);
>
>   	setup_msrs(vmx);
>
> @@ -7893,7 +7893,7 @@ static void dump_vmcs(void)
>   	u32 pin_based_exec_ctrl = vmcs_read32(PIN_BASED_VM_EXEC_CONTROL);
>   	u32 secondary_exec_control = 0;
>   	unsigned long cr4 = vmcs_readl(GUEST_CR4);
> -	u64 efer = vmcs_readl(GUEST_IA32_EFER);
> +	u64 efer = vmcs_read64(GUEST_IA32_EFER);
>   	int i, n;
>
>   	if (cpu_has_secondary_exec_ctrls())
> @@ -10159,7 +10159,7 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
>   	 * Additionally, restore L2's PDPTR to vmcs12.
>   	 */
>   	if (enable_ept) {
> -		vmcs12->guest_cr3 = vmcs_read64(GUEST_CR3);
> +		vmcs12->guest_cr3 = vmcs_readl(GUEST_CR3);
>   		vmcs12->guest_pdptr0 = vmcs_read64(GUEST_PDPTR0);
>   		vmcs12->guest_pdptr1 = vmcs_read64(GUEST_PDPTR1);
>   		vmcs12->guest_pdptr2 = vmcs_read64(GUEST_PDPTR2);
>



-- 
best regards
yang

      reply	other threads:[~2015-12-04  2:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 15:11 [PATCH] KVM: VMX: fix read/write sizes of VMCS fields Paolo Bonzini
2015-12-04  2:05 ` Yang Zhang [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=5660F4DA.7020604@gmail.com \
    --to=yang.zhang.wz@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@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