sgx_zap_enclave_ptes(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 🫢


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