From: "Huang, Kai" <kai.huang@intel.com>
To: "jarkko@kernel.org" <jarkko@kernel.org>, "Christopherson,,
Sean" <seanjc@google.com>
Cc: "linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"haitao.huang@linux.intel.com" <haitao.huang@linux.intel.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Subject: Re: [PATCH v2] x86/sgx: Allow exposing EDECCSSA user leaf function to KVM guest
Date: Mon, 29 Aug 2022 01:36:53 +0000 [thread overview]
Message-ID: <6d6c25b24cd49dfa5901f37f24df854e9125cd16.camel@intel.com> (raw)
In-Reply-To: <YweS9QRqaOgH7pNW@google.com>
On Thu, 2022-08-25 at 15:19 +0000, Sean Christopherson wrote:
> On Thu, Aug 25, 2022, Jarkko Sakkinen wrote:
> > Nit: shouldn't be this be x86/kvm?
>
> Heh, no, because x86/kvm is the scope for Linux running as a KVM guest, i.e. for
> changes to arch/x86/kernel/kvm.c.
>
> But yeah, "KVM: x86:" or maybe even "KVM: VMX:" would be preferable given that all
> of the meaningful changes are KVM specific.
>
> > On Thu, Aug 18, 2022 at 02:38:29PM +1200, Kai Huang wrote:
> > > The new Asynchronous Exit (AEX) notification mechanism (AEX-notify)
> > > allows one enclave to receive a notification in the ERESUME after the
> > > enclave exit due to an AEX. EDECCSSA is a new SGX user leaf function
> > > (ENCLU[EDECCSSA]) to facilitate the AEX notification handling. The new
> > > EDECCSSA is enumerated via CPUID(EAX=0x12,ECX=0x0):EAX[11].
> > >
> > > Besides Allowing reporting the new AEX-notify attribute to KVM guests,
> > > also allow reporting the new EDECCSSA user leaf function to KVM guests
> > > so the guest can fully utilize the AEX-notify mechanism.
> > >
> > > Similar to existing X86_FEATURE_SGX1 and X86_FEATURE_SGX2, introduce a
> > > new scattered X86_FEATURE_SGX_EDECCSSA bit for the new EDECCSSA, and
> > > report it in KVM's supported CPUIDs so the userspace hypervisor (i.e.
> > > Qemu) can enable it for the guest.
>
> Silly nit, but I'd prefer to leave off the "so the userspace hypervisor ... can
> enable it for the guest". Userspace doesn't actually need to wait for KVM enabling.
> As noted below, KVM doesn't need to do anything extra, and KVM _can't_ prevent the
> guest from using EDECCSSA.
Indeed KVM cannot prevent.
>
> > > Note there's no additional enabling work required to allow guest to use
> > > the new EDECCSSA. KVM is not able to trap ENCLU anyway.
>
> And maybe call out that the KVM "enabling" is not strictly necessary? And note
> that there's a virtualization hole? E.g.
>
> Note, no additional KVM enabling is required to allow the guest to use
> EDECCSSA, it's impossible to trap ENCLU (without completely preventing the
> guest from using SGX). Advertise EDECCSSA as supported purely so that
> userspace doesn't need to special case EDECCSSA, i.e. doesn't need to
> manually check host CPUID.
>
> The inability to trap ENCLU also means that KVM can't prevent the guest
> from using EDECCSSA, but that virtualization hole is benign as far as KVM
> is concerned. EDECCSSA is simply a fancy way to modify internal enclave
> state.
Thanks. Will use above.
--
Thanks,
-Kai
prev parent reply other threads:[~2022-08-29 1:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 2:38 Kai Huang
2022-08-25 3:26 ` Jarkko Sakkinen
2022-08-25 3:27 ` Jarkko Sakkinen
2022-08-25 15:19 ` Sean Christopherson
2022-08-25 15:44 ` Dave Hansen
2022-08-25 15:49 ` Sean Christopherson
2022-08-25 19:27 ` Jarkko Sakkinen
2022-08-29 1:37 ` Huang, Kai
2022-08-29 1:36 ` Huang, Kai [this message]
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=6d6c25b24cd49dfa5901f37f24df854e9125cd16.camel@intel.com \
--to=kai.huang@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=haitao.huang@linux.intel.com \
--cc=jarkko@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.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
all inboxes | Powered by JetHome®