sgx_virt_ecreate(9)
π sgx_virt_ecreate β the Kernel API Manual page, but make it make sense π«Ά
okay so bestie, you're in the kernel API manual section 9, and today's main character is sgx_virt_ecreate(9). yes it's a mouthful, no you don't have to say it out loud. it lives in the SGX corner of the kernel (you know, the ./arch/x86/kernel/cpu/sgx directory vibe) and it is lowkey doing a LOT of heavy lifting for KVM. let's get into it β¨
β¨ SYNOPSIS β¨
int sgx_virt_ecreate (struct sgx_pageinfo *pageinfo , void __user *secs
, int *trapnr );
look at that signature. three args, returns an int, very demure, very mindful. π
πΈ ARGUMENTS πΈ
pageinfoβ a pointer to thePAGEINFOstructure. it's giving "here's the info you need". πsecsβ a userspace pointer to the SECS page. yes, userspace pointer, so be normal about it. πtrapnrβ the trap number that gets injected to the guest if there's an ECREATE error. it's the "in case of emergency, here's what to throw" value. π¨
π DESCRIPTION π
so here's the tea, bestie. this function runs ECREATE on behalf of the guest, and it does it after KVM traps ECREATE β the whole point being to enforce the policies of the guest's enclaves. then it returns the trap number that should be injected to the guest in case of any ECREATE error. iconic behaviour, honestly. π
no cap, it's literally: KVM catches ECREATE, this function handles it, policies get enforced, and you get your trap number back for error reporting. that's the whole vibe check. π₯
π RETURN π
0β ECREATE was successful. slay. π<0β on error. π
π¦ SEE ALSO π¦
- Kernel file
./arch/x86/kernel/cpu/sgx/virt.c sgx_virt_einit(9)
π reminder bestie:secsis a userspace pointer (void __user *), and that__userannotation is not decorative. treat it with the respect it deserves.
and that's a wrap, fr fr. this page is from the ./arch/x86/kernel/cpu/sgx part of the Kernel API Manual, dated October 2026. go forth and ECREATE responsibly, my love. π
β¨π
π¦ 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