sgx_ioc_encl...modify_types(9)
π 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 astruct sgx_enclave_modify_typesinstance π
β¨ 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 toSGX_PAGE_TYPE_TRIMmarks the page for removal, with actual removal done by the handler ofSGX_IOC_ENCLAVE_REMOVE_PAGESioctl, called afterENCLU[EACCEPT]is run on theSGX_PAGE_TYPE_TRIMpage from within the enclave π so like β trim is the notice, remove is the actual eviction, andENCLU[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:
sgx_ioc_enclave_create(9)sgx_ioc_enclave_add_pages(9)sgx_ioc_enclave_init(9)sgx_ioc_enclave_provision(9)sgx_enclave_restrict_permissions(9)sgx_ioc_enclave_restrict_permissions(9)sgx_enclave_modify_types(9)sgx_encl_remove_pages(9)sgx_ioc_enclave_remove_pages(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms