SGX_ENCLS_FAULT_FLAG(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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