Skip to content

x86/sgx: Improve add pages ioctl

Sean Christopherson linux-sgx 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7x86/sgx: Modify ADD_PAGE ioctl to take offset instead of full addressarch/x86/include/uapi/asm/sgx.h arch/x86/kernel/cpu/sgx/ioctl.c+7 -70 replies
2/7selftests/x86/sgx: Update test to account for ADD_PAGE changetools/testing/selftests/x86/sgx/main.c+3 -40 replies
3/7x86/sgx: Tweak ADD_PAGE ioctl to allow adding multiple pagesarch/x86/include/uapi/asm/sgx.h arch/x86/kernel/cpu/sgx/ioctl.c+61 -237 replies
4/7selftests/x86/sgx: Update enclave build flow to do multi-page addtools/testing/selftests/x86/sgx/main.c+11 -160 replies
5/7x86/sgx: Add a flag to ADD_PAGES to allow replicating the source pagearch/x86/include/uapi/asm/sgx.h arch/x86/kernel/cpu/sgx/ioctl.c+8 -20 replies
6/7selftests/x86/sgx: Update selftest to account for ADD_PAGES flagtools/testing/selftests/x86/sgx/main.c+6 -40 replies
7/7selftests/x86/sgx: Add test coverage for reclaim and replicatetools/testing/selftests/x86/sgx/defines.h tools/testing/selftests/x86/sgx/main.c tools/testing/selftests/x86/sgx/sgxsign.c+53 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH for_v23 0/7] x86/sgx: Improve add pages ioctl

Enhance the SGX_IOC_ENCLAVE_ADD_PAGE{S} ioctl so that userspace can add multiple pages to an enclave in a single syscall. Also provide a flag that allows replicating a single source page to multiple target pages so that userspace doesn't need to allocate a giant chunk of memory when initializing things like the enlave's .bss, heap, etc...

People that actually develop runtimes, please weigh in. Jarkko also suggested going with a fully flexible ioctl, e.g. essentially creating an array of the existing struct so that mrmask and/or secinfo can be unique per page. AFAICT that's overkill and more cumbersome to use as it forces userspace to allocate the full array. My understanding is that the majority of enclaves will have contiguous blocks of pages with identical mrmask and secinfo, e.g. code segments, ro data, etc..., thus the less flexible but easier-in-theory to use approach proposed here.

Sean Christopherson (7):
x86/sgx: Modify ADD_PAGE ioctl to take offset instead of full address selftests/x86/sgx: Update test to account for ADD_PAGE change x86/sgx: Tweak ADD_PAGE ioctl to allow adding multiple pages selftests/x86/sgx: Update enclave build flow to do multi-page add x86/sgx: Add a flag to ADD_PAGES to allow replicating the source page selftests/x86/sgx: Update selftest to account for ADD_PAGES flag selftests/x86/sgx: Add test coverage for reclaim and replicate

 arch/x86/include/uapi/asm/sgx.h           | 25 +++++---
 arch/x86/kernel/cpu/sgx/ioctl.c           | 77 +++++++++++++++++------
 tools/testing/selftests/x86/sgx/defines.h | 28 +++++++++
 tools/testing/selftests/x86/sgx/main.c    | 40 ++++++------
 tools/testing/selftests/x86/sgx/sgxsign.c | 20 +++++-
 5 files changed, 140 insertions(+), 50 deletions(-)
Signature · 1 line
2.22.0