mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: dave.hansen@linux.intel.com, seanjc@google.com, x86@kernel.org,
	yang.zhong@intel.com, jarkko@kernel.org
Subject: Re: [PATCH v2 2/2] x86: sgx_vepc: implement SGX_IOC_VEPC_REMOVE ioctl
Date: Thu, 14 Oct 2021 15:14:33 -0700	[thread overview]
Message-ID: <a6f18a62-4e3e-b641-5ef9-4ada9eccd74d@intel.com> (raw)
In-Reply-To: <20211012105708.2070480-3-pbonzini@redhat.com>

On 10/12/21 3:57 AM, Paolo Bonzini wrote:
> For bare-metal SGX on real hardware, the hardware provides guarantees
> SGX state at reboot.  For instance, all pages start out uninitialized.
> The vepc driver provides a similar guarantee today for freshly-opened
> vepc instances, but guests such as Windows expect all pages to be in
> uninitialized state on startup, including after every guest reboot.
> 
> Some userspace implementations of virtual SGX would rather avoid having
> to close and reopen the /dev/sgx_vepc file descriptor and re-mmap the
> virtual EPC.  For example, they could sandbox themselves after the guest
> starts and forbid further calls to open(), in order to mitigate exploits
> from untrusted guests.
> 
> Therefore, add a ioctl that does this with EREMOVE.  Userspace can
> invoke the ioctl to bring its vEPC pages back to uninitialized state.
> There is a possibility that some pages fail to be removed if they are
> SECS pages, and the child and SECS pages could be in separate vEPC
> regions.  Therefore, the ioctl returns the number of EREMOVE failures,
> telling userspace to try the ioctl again after it's done with all
> vEPC regions.  A more verbose description of the correct usage and
> the possible error conditions is documented in sgx.rst.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

The new approach and revised changelogs look fine to me:

Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>

Like Jarkko mentioned, it would be _nice_ to have some self-contained
selftests around this.  Would it be a pain to rig something up in
selftests/kvm that at least trivially poked at /dev/sgx_vepc?

  parent reply	other threads:[~2021-10-14 22:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 10:57 [PATCH v2 0/2] x86: sgx_vepc: implement ioctl to EREMOVE all pages Paolo Bonzini
2021-10-12 10:57 ` [PATCH v2 1/2] x86: sgx_vepc: extract sgx_vepc_remove_page Paolo Bonzini
2021-10-12 16:53   ` Jarkko Sakkinen
2021-10-13 12:56   ` [tip: x86/sgx] x86/sgx/virt: Extract sgx_vepc_remove_page() tip-bot2 for Paolo Bonzini
2021-10-14 22:10   ` [PATCH v2 1/2] x86: sgx_vepc: extract sgx_vepc_remove_page Dave Hansen
2021-10-12 10:57 ` [PATCH v2 2/2] x86: sgx_vepc: implement SGX_IOC_VEPC_REMOVE ioctl Paolo Bonzini
2021-10-12 16:57   ` Jarkko Sakkinen
2021-10-12 17:03     ` Paolo Bonzini
2021-10-12 17:43       ` Jarkko Sakkinen
2021-10-13 12:56   ` [tip: x86/sgx] x86/sgx/virt: Implement " tip-bot2 for Paolo Bonzini
2021-10-14 22:14   ` Dave Hansen [this message]
2021-10-15 22:29   ` [PATCH v2 2/2] x86: sgx_vepc: implement " Sean Christopherson
2021-10-16  7:14     ` Paolo Bonzini
2021-10-13  6:54 ` [PATCH v2 0/2] x86: sgx_vepc: implement ioctl to EREMOVE all pages Borislav Petkov
2021-10-13  7:15   ` Paolo Bonzini
2021-10-13  7:38     ` Borislav Petkov
2021-10-14 12:21 ` Yang Zhong

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=a6f18a62-4e3e-b641-5ef9-4ada9eccd74d@intel.com \
    --to=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jarkko@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=x86@kernel.org \
    --cc=yang.zhong@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome