Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1719773
| Path | csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Paolo Bonzini <pbonzini@redhat.com> |
| Newsgroups | linux.kernel |
| Subject | Re: linux-next: manual merge of the kvm tree with the tip tree |
| Date | Fri, 25 Aug 2017 08:40:01 +0200 |
| Message-ID | <uigrD-xp-9@gated-at.bofh.it> (permalink) |
| References | <uiezw-7NM-17@gated-at.bofh.it> |
| X-Original-To | Stephen Rothwell <sfr@canb.auug.org.au>, Radim Krčmář <rkrcmar@redhat.com>, KVM <kvm@vger.kernel.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>, Peter Zijlstra <peterz@infradead.org> |
| Dmarc-Filter | OpenDMARC Filter v1.3.2 mx1.redhat.com 2896F7E445 |
| Authentication-Results | ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com |
| Authentication-Results | ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Language | en-US |
| Content-Transfer-Encoding | 8bit |
| X-Scanned-By | MIMEDefang 2.79 on 10.5.11.16 |
| X-Greylist | Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 25 Aug 2017 06:39:27 +0000 (UTC) |
| 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 | 83 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Linux-Next Mailing List <linux-next@vger.kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Tom Lendacky <thomas.lendacky@amd.com>, Yu Zhang <yu.c.zhang@linux.intel.com>, Brijesh Singh <brijesh.singh@amd.com> |
| X-Original-Date | Fri, 25 Aug 2017 08:39:22 +0200 |
| X-Original-Message-ID | <2984689e-ab4e-0c22-7151-adfeeffce4ed@redhat.com> |
| X-Original-References | <20170825143930.494744fe@canb.auug.org.au> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1719773 |
Show key headers only | View raw
On 25/08/2017 06:39, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the kvm tree got a conflict in:
>
> arch/x86/kvm/mmu.h
>
> between commit:
>
> d0ec49d4de90 ("kvm/x86/svm: Support Secure Memory Encryption within KVM")
>
> from the tip tree and commit:
>
> d1cd3ce90044 ("KVM: MMU: check guest CR3 reserved bits based on its physical address width.")
>
> from the kvm tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
>
Thomas L., Ingo,
this is completely wrong:
>
> static inline u64 rsvd_bits(int s, int e)
> {
> - return ((1ULL << (e - s + 1)) - 1) << s;
> + return __sme_clr(((1ULL << (e - s + 1)) - 1) << s);
> }
>
First, rsvd_bits is just a simple function to return some 1 bits. Applying
a mask based on properties of the host MMU is incorrect.
Second, the masks computed by __reset_rsvds_bits_mask also apply to
guest page tables, where the C bit is reserved since we don't emulate
SME.
Something like this:
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 2dafd36368cc..e0597d703d72 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -4142,16 +4142,24 @@ void
reset_shadow_zero_bits_mask(struct kvm_vcpu *vcpu, struct kvm_mmu *context)
{
bool uses_nx = context->nx || context->base_role.smep_andnot_wp;
+ struct rsvd_bits_validate *shadow_zero_check;
+ int i;
/*
* Passing "true" to the last argument is okay; it adds a check
* on bit 8 of the SPTEs which KVM doesn't use anyway.
*/
- __reset_rsvds_bits_mask(vcpu, &context->shadow_zero_check,
+ shadow_zero_check = &context->shadow_zero_check;
+ __reset_rsvds_bits_mask(vcpu, shadow_zero_check,
boot_cpu_data.x86_phys_bits,
context->shadow_root_level, uses_nx,
guest_cpuid_has(vcpu, X86_FEATURE_GBPAGES),
is_pse(vcpu), true);
+
+ for (i = context->shadow_root_level; --i >= 0; ) {
+ shadow_zero_check->rsvd_bits_mask[i][0] &= ~shadow_me_mask;
+ shadow_zero_check->rsvd_bits_mask[i][1] &= ~shadow_me_mask;
+ }
}
EXPORT_SYMBOL_GPL(reset_shadow_zero_bits_mask);
Can you please fix it up? Please Cc me at paolo.bonzini@gmail.com too
because I'll be on vacation next week.
(And thanks Stephen for the heads-up!)
Paolo
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
linux-next: manual merge of the kvm tree with the tip tree Stephen Rothwell <sfr@canb.auug.org.au> - 2017-08-25 06:40 +0200
Re: linux-next: manual merge of the kvm tree with the tip tree Paolo Bonzini <pbonzini@redhat.com> - 2017-08-25 08:40 +0200
Re: linux-next: manual merge of the kvm tree with the tip tree Paolo Bonzini <pbonzini@redhat.com> - 2017-08-25 22:10 +0200
Re: linux-next: manual merge of the kvm tree with the tip tree Paolo Bonzini <pbonzini@redhat.com> - 2017-08-25 22:50 +0200
Re: linux-next: manual merge of the kvm tree with the tip tree Ingo Molnar <mingo@kernel.org> - 2017-08-26 09:30 +0200
csiph-web