mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Cc: gleb@kernel.org, mtosatti@redhat.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/9] KVM: MMU: introduce the framework to check reserved bits on sptes
Date: Tue, 4 Aug 2015 15:23:00 +0200	[thread overview]
Message-ID: <55C0BCB4.3020601@redhat.com> (raw)
In-Reply-To: <55C0B9B1.9070504@linux.intel.com>



On 04/08/2015 15:10, Xiao Guangrong wrote:
>>
>> This should be cpu_has_nx, I think.
> 
> cpu_has_nx() checks the feature on host CPU, however, this is the shadow
> page table which completely follow guest's features.
> 
> E.g, if guest does not execution-protect the physical page, then
> KVM does not do it either.

That's just true for current code.  In principle you could add a memslot
flag for KVM_MEMSLOT_NO_EXECUTE, then NX would be true on an spte but
not on a PTE.

>>
>>> +                guest_cpuid_has_gbpages(vcpu),
>>
>> This should be cpu_has_gbpages.
> 
> E.g, if guest does not use 1G page size, it's also not used in shadow page
> table.

However, bit 7 in the shadow PDPTE is not reserved.  If you're not
testing "is this bit reserved" but rather "should this bit be always
zero" in the SPTE, then checking guest_cpuid is okay.  But in that case
shadow_rsvd_check is really more like shadow_always_zero_check.

>>
>>> is_pse(vcpu));
>>
>> This should be cpu_has_pse.
> 
> E.g, guest does no use 4M page size, then KVM does not use it either.

Right, it should always be true, not cpu_has_pse, because PAE and 64-bit
page tables always support huge (2M) pages.  Or as above, if you're
testing "should this bit be always zero" then it's a different story.

Paolo

> BTW, cpu_pse only hurts 32 bit page table which is not used by shadow
> page table (32 PAE and 64 Long mode are used in shadow page).
> 
> Only tdp only follows host CPU's features, KVM does not use NX to
> protect the page, so i always mark it as false in
> reset_tdp_shadow_rsvds_bits_mask().

  reply	other threads:[~2015-08-04 13:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 10:59 [PATCH 0/9] KVM: MMU: fix and improve validation of mmio page fault Xiao Guangrong
2015-08-04 10:59 ` [PATCH 1/9] KVM: MMU: fix " Xiao Guangrong
2015-08-04 10:59 ` [PATCH 2/9] KVM: MMU: move FNAME(is_rsvd_bits_set) to mmu.c Xiao Guangrong
2015-08-04 10:59 ` [PATCH 3/9] KVM: MMU: introduce rsvd_bits_validate Xiao Guangrong
2015-08-04 10:59 ` [PATCH 4/9] KVM: MMU: split reset_rsvds_bits_mask Xiao Guangrong
2015-08-04 10:59 ` [PATCH 5/9] KVM: MMU: split reset_rsvds_bits_mask_ept Xiao Guangrong
2015-08-04 10:59 ` [PATCH 6/9] KVM: MMU: introduce the framework to check reserved bits on sptes Xiao Guangrong
2015-08-04 12:14   ` Paolo Bonzini
2015-08-04 13:10     ` Xiao Guangrong
2015-08-04 13:23       ` Paolo Bonzini [this message]
2015-08-04 13:34         ` Xiao Guangrong
2015-08-04 10:59 ` [PATCH 7/9] KVM: MMU: introduce is_shadow_rsvd_bits_set() Xiao Guangrong
2015-08-04 10:59 ` [PATCH 8/9] KVM: MMU: fully check reserved bits for sptes Xiao Guangrong
2015-08-04 10:59 ` [PATCH 9/9] KVM: VMX: drop ept misconfig check Xiao Guangrong
2015-08-04 11:04 ` [PATCH 0/9] KVM: MMU: fix and improve validation of mmio page fault Xiao Guangrong

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=55C0BCB4.3020601@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@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

Powered by JetHome