Skip to content

x86: sgx_vepc: implement ioctl to EREMOVE all pages

Paolo Bonzini kvm lkml 4 versions – Applied

Status from this message: The following commit has been merged into the x86/sgx branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 2 repliesApplied
  2. v32 patches 8 repliesSuperseded
  3. v22 patches 12 repliesApplied
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches7 repliesSuperseded

Changes in v4 from the cover letter

- keep the warning if EREMOVE causes a #PF (or any other fault than a general protection fault)

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/2x86: sgx_vepc: extract sgx_vepc_remove_pagearch/x86/kernel/cpu/sgx/virt.c+7 -50 replies
2/2x86: sgx_vepc: implement SGX_IOC_VEPC_REMOVE ioctlDocumentation/x86/sgx.rst arch/x86/include/uapi/asm/sgx.h arch/x86/kernel/cpu/sgx/virt.c+90 -01 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJarkko SakkinenDave HansenSean Christopherson
1/2R-b R-b
2/2R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 0/2] x86: sgx_vepc: implement ioctl to EREMOVE all pages

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

Changes from v2:
- return EBUSY also if EREMOVE causes a general protection fault

Changes from v3:
- keep the warning if EREMOVE causes a #PF (or any other fault than a general protection fault)

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       | 35 +++++++++++++++++++++
 arch/x86/include/uapi/asm/sgx.h |  2 ++
 arch/x86/kernel/cpu/sgx/virt.c  | 63 ++++++++++++++++++++++++++++++---
 3 files changed, 95 insertions(+), 5 deletions(-)
Signature · 1 line
2.27.0