All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liran Alon <liran.alon@oracle.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"Singh, Brijesh" <brijesh.singh@amd.com>,
	"rkrcmar@redhat.com" <rkrcmar@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH 1/2] KVM: SVM: Fix workaround for AMD Errata 1096
Date: Tue, 16 Jul 2019 22:50:11 +0300	[thread overview]
Message-ID: <AAA25F54-FFB6-41F9-98A1-BC07E8B99288@oracle.com> (raw)
In-Reply-To: <20190716194535.GB28096@linux.intel.com>



> On 16 Jul 2019, at 22:45, Sean Christopherson <sean.j.christopherson@intel.com> wrote:
> 
> On Tue, Jul 16, 2019 at 09:39:48PM +0200, Paolo Bonzini wrote:
>> On 16/07/19 21:34, Liran Alon wrote:
>>>> When this errata is hit, the CPU will be at CPL3. From hardware
>>>> point-of-view the below sequence happens:
>>>> 
>>>> 1. CPL3 guest hits reserved bit NPT fault (MMIO access)
>>> Why CPU needs to be at CPL3?
>>> The requirement for SMAP should be that this page is user-accessible in guest page-tables.
>>> Think on a case where guest have CR4.SMAP=1 and CR4.SMEP=0.
>>> 
>> 
>> If you are not at CPL3, you'd get a SMAP NPF, not a RSVD NPF.
> 
> I think Liran is right.  When software is executing, the %rip access is
> a code fetch (SMEP), but the ucode assist is a data access (SMAP).
> 
> This likely has only been observed in a CPL3 scenario because no sane OS
> exercises the case of the kernel executing from a user page with SMAP=1
> and SMEP=0.

True. I’m trying to be pedantic and accurate here. :)
I think we should just remove the vCPU CPL check and remain only with the CR4.SMAP check.
Don’t you agree that having a #NPF that returns 0 instruction bytes with DecodeAssist enabled and CR4.SMAP=1
is sufficient for finger-printing this Errata? With which other use-case it’s expected to collide?

-Liran

  reply	other threads:[~2019-07-16 19:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 20:30 KVM: SVM: Fix workaround for AMD Errata 1096 Liran Alon
2019-07-15 20:30 ` [PATCH 1/2] " Liran Alon
2019-07-16 15:48   ` Singh, Brijesh
2019-07-16 15:56     ` Liran Alon
2019-07-16 16:07       ` Liran Alon
2019-07-16 16:10       ` Singh, Brijesh
2019-07-16 16:20         ` Liran Alon
2019-07-16 16:41           ` Sean Christopherson
2019-07-16 16:56             ` Liran Alon
2019-07-16 17:27               ` Sean Christopherson
2019-07-16 17:27               ` Paolo Bonzini
2019-07-16 17:35                 ` Liran Alon
2019-07-16 19:28                   ` Singh, Brijesh
2019-07-16 19:34                     ` Liran Alon
2019-07-16 19:39                       ` Paolo Bonzini
2019-07-16 19:45                         ` Sean Christopherson
2019-07-16 19:50                           ` Liran Alon [this message]
2019-07-16 19:47                         ` Liran Alon
2019-07-16 19:41                       ` Sean Christopherson
2019-07-16 19:52                         ` Liran Alon
2019-07-16 20:02                       ` Singh, Brijesh
2019-07-16 20:07                         ` Sean Christopherson
2019-07-16 20:13                           ` Paolo Bonzini
2019-07-16 20:09                         ` Liran Alon
2019-07-16 20:27                           ` Singh, Brijesh
2019-07-16 20:54                             ` Sean Christopherson
2019-07-16 21:53                               ` Liran Alon
2019-07-16 18:05           ` Singh, Brijesh
2019-07-16 18:06             ` Singh, Brijesh
2019-07-15 20:30 ` [PATCH 2/2] KVM: x86: Rename need_emulation_on_page_fault() to handle_no_insn_on_page_fault() Liran Alon
2019-07-16 15:48   ` Sean Christopherson
2019-07-16 16:01     ` Liran Alon
2019-07-16 16:10       ` Sean Christopherson
2019-07-16 19:33         ` Singh, Brijesh

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=AAA25F54-FFB6-41F9-98A1-BC07E8B99288@oracle.com \
    --to=liran.alon@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=brijesh.singh@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.