mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kvm@vger.kernel.org, Lai Jiangshan <laijs@linux.alibaba.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Sean Christopherson <sean.j.christopherson@intel.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	X86 ML <x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	Avi Kivity <avi@qumranet.com>,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH] kvm/x86/mmu: use the correct inherited permissions to get shadow page
Date: Mon, 30 Nov 2020 18:53:41 +0100	[thread overview]
Message-ID: <7a9d3517-7bcc-723a-5ec5-80018d0850d7@redhat.com> (raw)
In-Reply-To: <X8Uux62rJdf2feJ2@google.com>

On 30/11/20 18:41, Sean Christopherson wrote:
>>
>> pmd1 and pmd2 point to the same pte table, so:
>> ptr1 and ptr3 points to the same page.
>> ptr2 and ptr4 points to the same page.
>>
>>    The guess read-accesses to ptr1 first. So the hypervisor gets the
>> shadow pte page table with role.access=u-- among other things.
>>     (Note the shadowed pmd1's access is uwx)
>>
>>    And then the guest write-accesses to ptr2, and the hypervisor
>> set up shadow page for ptr2.
>>     (Note the hypervisor silencely accepts the role.access=u--
>>      shadow pte page table in FNAME(fetch))
>>
>>    After that, the guess read-accesses to ptr3, the hypervisor
>> reused the same shadow pte page table as above.
>>
>>    At last, the guest writes to ptr4 without vmexit nor pagefault,
>> Which should cause vmexit as the guest expects.
>
> Hmm, yes, KVM would incorrectly handle this scenario.  But, the proposed patch
> would not address the issue as KVM always maps non-leaf shadow pages with full
> access permissions.

Can we have a testcase in kvm-unit-tests?  It's okay of course if it 
only fails with ept=0.

Paolo


  reply	other threads:[~2020-11-30 17:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20  9:55 Lai Jiangshan
2020-11-26  0:05 ` Sean Christopherson
2020-11-27 16:48   ` Paolo Bonzini
2020-11-28  2:04     ` Lai Jiangshan
2020-11-30 17:41       ` Sean Christopherson
2020-11-30 17:53         ` Paolo Bonzini [this message]
2020-12-01  1:31         ` Lai Jiangshan
2021-06-03  5:24 ` [PATCH V2] KVM: X86: MMU: Use " Lai Jiangshan
2021-06-03 17:59   ` Sean Christopherson
2021-06-08 17:09     ` Paolo Bonzini

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=7a9d3517-7bcc-723a-5ec5-80018d0850d7@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=avi@qumranet.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=hpa@zytor.com \
    --cc=jiangshanlai@gmail.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=laijs@linux.alibaba.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®