STRUCT SGX_ENCLAVE_RUN(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct sgx_enclave_run(9)

okay so bestie, welcome to the Kernel API Manual ✨ like yes, we're reading kernel headers today and honestly? we're thriving. this is the whole vibe of struct sgx_enclave_run β€” the execution context for __vdso_sgx_enter_enclave(). it's giving "backstage pass for your enclave" πŸŽ€


🌸 NAME 🌸

struct sgx_enclave_run β€” the execution context of __vdso_sgx_enter_enclave(). that's it, that's the whole name, and it ate πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

like, here's the struct, copied exactly, do not touch, no edits, we respect the source πŸ’–

struct sgx_enclave_run {
    __u64 tcs;
    __u32 function;
    __u16 exception_vector;
    __u16 exception_error_code;
    __u64 exception_addr;
    __u64 user_handler;
    __u64 user_data;
    __u8 reserved[216];
 };

✨ Members ✨

bestie, let's go field by field, no skipping, we do not skip here πŸ‘‘

  • tcs β€” the TCS used to enter the enclave. that's the ticket they check at the door 🎟️
  • function β€” the last seen ENCLU function, so it's one of EENTER, ERESUME or EEXIT. it's literally remembering what just happened, king behavior πŸ‘‘
  • exception_vector β€” the interrupt vector of the exception 🌈
  • exception_error_code β€” the exception error code, pulled straight out of the stack. scooped it up ourselves, iconic πŸ“
  • exception_addr β€” the address that triggered the exception. the scene of the crime, if you will πŸ”₯
  • user_handler β€” a user provided callback that gets run on exception 🫢
  • user_data β€” the data passed to the user handler. little gift bag for your callback πŸŽ€
  • reserved β€” reserved for future extensions. don't touch it, it's saving that seat for someone πŸ‘€

πŸ’œ Description πŸ’œ

okay so this is the important part, listen up 🧚

If user_handler is provided, the handler will be invoked on all return paths of the normal flow. literally all of them, no skipping, the handler is main character energy 🌟

The user handler may transfer control β€” e.g. via a longjmp call or a C++ exception β€” without returning to __vdso_sgx_enter_enclave. yep, it can just dip πŸ’¨ like it never even said bye. so don't be out here assuming it always comes back, because it fr fr might not 😭


πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, iykyk:


alright bestie, that's the page πŸ’– huge shoutout to ./arch/x86/include/uapi/asm and the October 2026 date stamp for making this possible β€” mwah, slay, periodt πŸ«Άβœ¨πŸ’…

πŸ“¦ where this page comes from