sgx_encl_alloc_backing(9)
π sgx_encl_alloc_backing(9) β the kernel API manual, bestie edition π
okay so the manual name is sgx_encl_alloc_backing, section 9 of the Kernel API Manual, and honestly? she's a little niche but she serves. come sit with me π«Ά
β¨ NAME β¨
sgx_encl_alloc_backing β literally just creating a brand new backing storage page, no big deal π
πΈ SYNOPSIS πΈ
int sgx_encl_alloc_backing (struct sgx_encl *encl , unsigned long
page_index , struct sgx_backing *backing );
that's the whole vibe check right there π
π¦ ARGUMENTS π¦
enclβ an enclave pointer, bestie. it's giving "the main character" π§page_indexβ the enclave page index, aka where in the page lineup we're at π₯backingβ data for accessing the backing storage for the page. the lil access pass π
π DESCRIPTION π
okay so picture this. when this gets called from ksgxd, it sets the active memcg from one of the mms in the enclave's mm_list before any backing page allocation happens β the whole point being to make sure those shmem page allocations get charged to the enclave, no cap π€β¨
then it creates a backing page so you can load data back into an EPC page with ELDU. iconic behavior, honestly.
π¨ important bestie alert: this function takes a reference on a new backing page, and you must drop it with a corresponding call to sgx_encl_put_backing. don't leave her hanging, that's so not slay π
β RETURN β
0 on success, -errno otherwise. that's it, that's the whole story π
π SEE ALSO π
the kernel file, right here in the flesh:
./arch/x86/kernel/cpu/sgx/encl.c
and a whole friend group of cross-references, all of them absolutely invited to the group chat π :
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_lookup_backing(9)sgx_encl_put_backing(9)sgx_encl_test_and_clear_young(9)sgx_zap_enclave_ptes(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)
πΈ mwah, that's the page! this iconic little number lives at ./arch/x86/kernel/cpu/sgx, dated October 2026, and it goes by sgx_encl_alloc_backing(9). 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