sgx_ioc_encl...modify_types(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… sgx_ioc_encl...modify_types(9) β€” like, the glow-up edition ✨

okay bestie, so this is a page from the Kernel API Manual (section 9, kernel-space gang 🫢), and the name of the whole thing is sgx_ioc_enclave_modify_types β€” yes, the header is squished to sgx_ioc_encl...modify_types(9) because even man pages have a character limit, tragic, we move on πŸ’€


πŸŽ€ NAME πŸŽ€

sgx_ioc_enclave_modify_types β€” the handler for %SGX_IOC_ENCLAVE_MODIFY_TYPES. that's it, that's the tweet ✨


🌸 SYNOPSIS 🌸

long sgx_ioc_enclave_modify_types (struct sgx_encl *encl , void __user
*arg );

literally the whole signature, don't come for me about the line wrap πŸ™ˆ


πŸ¦‹ ARGUMENTS πŸ¦‹

  • encl β€” an enclave pointer πŸ‘‘ (this is the main character)
  • arg β€” a userspace pointer to a struct sgx_enclave_modify_types instance πŸ’–

✨ DESCRIPTION ✨

the ability to change the enclave page type supports the following use cases, and honestly? iconic behaviour:

  • it is possible to add TCS pages to an enclave by changing the type of regular pages (SGX_PAGE_TYPE_REG) to TCS (SGX_PAGE_TYPE_TCS) pages. with this support the number of threads supported by an initialized enclave can be increased dynamically πŸ”₯ like, glow-up your thread count while it's already running, no reboot era
  • regular or TCS pages can dynamically be removed from an initialized enclave by changing the page type to SGX_PAGE_TYPE_TRIM. changing the page type to SGX_PAGE_TYPE_TRIM marks the page for removal, with actual removal done by the handler of SGX_IOC_ENCLAVE_REMOVE_PAGES ioctl, called after ENCLU[EACCEPT] is run on the SGX_PAGE_TYPE_TRIM page from within the enclave πŸ‘€ so like β€” trim is the notice, remove is the actual eviction, and ENCLU[EACCEPT] has to happen in between, iykyk

πŸ’€ RETURN πŸ’€

  • 0 β€” success πŸŽ‰ slay
  • -errno β€” otherwise 😭 that's the vibe check failing

🌈 SEE ALSO 🌈

kernel file ./arch/x86/kernel/cpu/sgx/ioctl.c, plus the whole friend group:


and that's the whole page, no crumbs left πŸ’… this lil masterpiece lives in ./arch/x86/kernel/cpu/sgx, dated October 2026, and it's brought to you by the same sgx_ioc_encl...modify_types(9) energy as the top of the page β€” full circle, periodt πŸ§šπŸ’œ

πŸ“¦ where this page comes from