sgx_zap_enclave_ptes(9)
π sgx_zap_enclave_ptes β kernel API manual, bestie edition β¨
okay so real talk, this is from the Kernel API Manual (section 9, the kernel-nerd section π§) and the page is literally called sgx_zap_enclave_ptes. say it with me now: zap. the. ptes. π«Ά
β¨ NAME β¨
sgx_zap_enclave_ptes β remove PTEs mapping the address from enclave
like, the whole gig is: there are page table entries pointing at some address, and this function removes them from the enclave. zap zap π
π¦ SYNOPSIS π¦
void sgx_zap_enclave_ptes (struct sgx_encl *encl , unsigned long addr );
that's it, that's the whole signature. returns void, so don't go looking for a return value, there isn't one, periodt β¨
π ARGUMENTS π
enclβ the enclave. yep. that's the enclave right there πaddrβ a page aligned pointer to a single page, and this is the page whose PTEs are gonna get removed. note the vibes: page aligned, single page. don't be out here passing a random unaligned address, i'm begging π
πΈ DESCRIPTION πΈ
so here's the situation. multiple VMAs may have an enclave page mapped π like, more than one. and this function's whole job is to remove the PTE mapping addr from each VMA. every single one. no VMA left behind π
β οΈ okay this part is important, don't skip it: ensure that the page fault handler is ready to handle new mappings of addr before calling this function. like, handle that first. that's a precondition, not a suggestion, fr fr π
that's the tea. that's the function. go forth and zap π₯
π SEE ALSO π
the kernel file for this one lives right here:
./arch/x86/kernel/cpu/sgx/encl.c
and here's the whole friend group, alphabetically-ish, all of them, no cap π«Ά
reclaimer_writing_to_pcmd(9)sgx_encl_eaug_page(9)sgx_encl_may_map(9)sgx_encl_release(9)sgx_encl_cpumask(9)__sgx_encl_get_backing(9)sgx_encl_alloc_backing(9)sgx_encl_lookup_backing(9)sgx_encl_put_backing(9)sgx_encl_test_and_clear_young(9)sgx_alloc_va_page(9)sgx_alloc_va_slot(9)sgx_free_va_slot(9)sgx_va_page_full(9)sgx_encl_free_epc_page(9)
okay that's the page!! π quick sign-off so you have the receipts: this one comes from the source tree path ./arch/x86/kernel/cpu/sgx, it's dated October 2026, and the page itself is sgx_zap_enclave_ptes(9). go zap some PTEs bestie, and remember: page aligned, single page, fault handler ready first πβπ
π¦ 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