Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1711947

Re: [PATCH v1 1/4] KVM: MMU: check guest CR3 reserved bits based on its physical address width.

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Yu Zhang <yu.c.zhang@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v1 1/4] KVM: MMU: check guest CR3 reserved bits based on its physical address width.
Date Tue, 15 Aug 2017 10:20:02 +0200
Message-ID <ueFeW-7hm-13@gated-at.bofh.it> (permalink)
References <udF7k-1tj-11@gated-at.bofh.it> <udF7j-1tj-9@gated-at.bofh.it> <ueqfU-6mT-13@gated-at.bofh.it> <ueqIW-6xI-11@gated-at.bofh.it>
X-Original-To Paolo Bonzini <pbonzini@redhat.com>, Jim Mattson <jmattson@google.com>
X-Extloop1 1
X-Ironport-Av E=Sophos;i="5.41,377,1498546800"; d="scan'208";a="137541377"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 34
Organization linux.* mail to news gateway
X-Original-Cc kvm list <kvm@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>, Radim Krčmář <rkrcmar@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>, xiaoguangrong@tencent.com, Joerg Roedel <joro@8bytes.org>
X-Original-Date Tue, 15 Aug 2017 15:50:36 +0800
X-Original-Message-ID <baa5e093-eb22-d29a-1a51-889c1d7342c7@linux.intel.com>
X-Original-References <1502544906-1108-1-git-send-email-yu.c.zhang@linux.intel.com> <1502544906-1108-2-git-send-email-yu.c.zhang@linux.intel.com> <CALMp9eS1r30miVs-p4p5WLm1vn=FAGMkLxbjRWcLzw97ctp_XA@mail.gmail.com> <a8b2eab0-cd3c-2bc2-a2c9-741f88c866de@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1711947

Show key headers only | View raw



On 8/15/2017 12:40 AM, Paolo Bonzini wrote:
> On 14/08/2017 18:13, Jim Mattson wrote:
>>>                  ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
>>> -               if (efer & EFER_LMA)
>>> -                       rsvd = CR3_L_MODE_RESERVED_BITS & ~CR3_PCID_INVD;
>>> +               if (efer & EFER_LMA) {
>>> +                       u64 maxphyaddr;
>>> +                       u32 eax = 0x80000008;
>>> +
>>> +                       ctxt->ops->get_cpuid(ctxt, &eax, NULL, NULL, NULL);
>>> +                       maxphyaddr = eax * 0xff;
>> What if leaf 0x80000008 is not defined?
> I noticed this too, but I thought it was mitigated by being under
> EFER_LMA.  Unfortunately, kvm_set_efer doesn't check
> guest_cpuid_has_longmode, so I guess you do have to test leaf 0x80000000
> first.  Alternatively:
>
> 1) kvm_cpuid could return false if it's falling back to
> check_cpuid_limit, and emulator_get_cpuid can then be changed to return bool
>
> 2) kvm_cpuid and emulator_get_cpuid could gain a new argument to disable
> the check_cpuid_limit fallback.
>
> Yu, would you like to implement the latter?

Thanks for pointing this out, Jim & Paolo. The latter choice sounds 
better to me. :-)
I'd like to implement this in a separate patch in next version patch set.

Yu
> Paolo
>

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v1 1/4] KVM: MMU: check guest CR3 reserved bits based on its physical address width. Yu Zhang <yu.c.zhang@linux.intel.com> - 2017-08-12 16:00 +0200
  Re: [PATCH v1 1/4] KVM: MMU: check guest CR3 reserved bits based on  its physical address width. Paolo Bonzini <pbonzini@redhat.com> - 2017-08-14 09:40 +0200
    Re: [PATCH v1 1/4] KVM: MMU: check guest CR3 reserved bits based on  its physical address width. Yu Zhang <yu.c.zhang@linux.intel.com> - 2017-08-14 14:10 +0200
  Re: [PATCH v1 1/4] KVM: MMU: check guest CR3 reserved bits based on  its physical address width. Jim Mattson <jmattson@google.com> - 2017-08-14 18:20 +0200
    Re: [PATCH v1 1/4] KVM: MMU: check guest CR3 reserved bits based on  its physical address width. Paolo Bonzini <pbonzini@redhat.com> - 2017-08-14 18:50 +0200
      Re: [PATCH v1 1/4] KVM: MMU: check guest CR3 reserved bits based on  its physical address width. Yu Zhang <yu.c.zhang@linux.intel.com> - 2017-08-15 10:20 +0200

csiph-web