kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] x86: sgx_vepc: implement ioctl to EREMOVE all pages
@ 2021-10-12 10:57 Paolo Bonzini
  2021-10-12 10:57 ` [PATCH v2 1/2] x86: sgx_vepc: extract sgx_vepc_remove_page Paolo Bonzini
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Paolo Bonzini @ 2021-10-12 10:57 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: dave.hansen, seanjc, x86, yang.zhong, jarkko

Add to /dev/sgx_vepc a ioctl that brings vEPC pages back to uninitialized
state with EREMOVE.  This is useful in order to match the expectations
of guests after reboot, and to match the behavior of real hardware.

The ioctl is a cleaner alternative to closing and reopening the
/dev/sgx_vepc device; reopening /dev/sgx_vepc could be problematic in
case userspace has sandboxed itself since the time it first opened the
device, and has thus lost permissions to do so.

If possible, I would like these patches to be included in 5.15 through
either the x86 or the KVM tree.

Thanks,

Paolo

Changes from RFC:
- improved commit messages, added documentation
- renamed ioctl from SGX_IOC_VEPC_REMOVE to SGX_IOC_VEPC_REMOVE_ALL

Change from v1:
- fixed documentation and code to cover SGX_ENCLAVE_ACT errors
- removed Tested-by since the code is quite different now

Paolo Bonzini (2):
  x86: sgx_vepc: extract sgx_vepc_remove_page
  x86: sgx_vepc: implement SGX_IOC_VEPC_REMOVE_ALL ioctl

 Documentation/x86/sgx.rst       | 26 +++++++++++++
 arch/x86/include/asm/sgx.h      |  3 ++
 arch/x86/include/uapi/asm/sgx.h |  2 +
 arch/x86/kernel/cpu/sgx/virt.c  | 69 ++++++++++++++++++++++++++++++---
 4 files changed, 95 insertions(+), 5 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-10-16  7:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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-14 22:10   ` 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-14 22:14   ` Dave Hansen
2021-10-15 22:29   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).