SGX_ENCLS_FAULT_FLAG(9)
π SGX_ENCLS_FAULT_FLAG π
Okay bestie, welcome to the Kernel API Manual page for SGX_ENCLS_FAULT_FLAG β yes, that is the manual name too, and this whole page is about one iconic little flag. Let's get into it. β¨
πΈ NAME πΈ
SGX_ENCLS_FAULT_FLAG β flag signifying an ENCLS return code is a trapnr.
β¨ SYNOPSIS β¨
SGX_ENCLS_FAULT_FLAG
π¦ DESCRIPTION π¦
Okay so here's the tea: ENCLS has its own (positive value) error codes, and it also generates ENCLS specific #GP and #PF faults. And those ENCLS values get munged with system error codes as everything percolates back up the stack. π
Unfortunately (for us), we need to precisely identify each unique error code. For example, the action taken if EWB fails varies based on the type of fault and on the exact SGX error code β so we can't simply convert all faults to -EFAULT. Lowkey that would be a whole mess. π
To make all three error types coexist, we set bit 30 to identify an ENCLS fault. Bit 31 (technically bits N:31) is used to differentiate between positive values (faults and SGX error codes) and negative values (system error codes). Periodt. π
π SEE ALSO π
Kernel file ./arch/x86/include/asm/sgx.h:
enum sgx_return_code(9)enum sgx_miscselect(9)enum sgx_attribute(9)struct sgx_secs(9)enum sgx_tcs_flags(9)struct sgx_tcs(9)struct sgx_pageinfo(9)enum sgx_page_type(9)enum sgx_secinfo_flags(9)struct sgx_secinfo(9)struct sgx_pcmd(9)struct sgx_sigstruct_header(9)struct sgx_sigstruct_body(9)struct sgx_sigstruct(9)
Cute sign-off time, bestie: this page's source/version is ./arch/x86/include/asm, the date stamp is October 2026, and the manual tag is SGX_ENCLS_FAULT_FLAG(9). Go slay those error codes π
β¨π«Ά
π¦ 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