sgx_encl_may_map(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

sgx_encl_may_map β€” bestie, this is the vibe check for whether a requested VMA mapping is actually allowed ✨

(also hi, you're reading the Kernel API Manual, welcome to the function-call side of the group chat 🫢)


πŸŽ€ SYNOPSIS πŸŽ€

int sgx_encl_may_map (struct sgx_encl *encl , unsigned long start ,
       unsigned long end , vm_flags_t vm_flags );

🌸 ARGUMENTS 🌸

  • encl β€” an enclave pointer πŸ‘‘ (yes, the whole enclave, main character energy)
  • start β€” the lower bound of the address range, and it's inclusive (so start is invited to the party)
  • end β€” the upper bound of the address range, and it's exclusive (so end is literally not invited, no cap)
  • vm_flags β€” the VMA flags, aka the permissions being requested πŸ¦‹

🧚 DESCRIPTION 🧚

Okay so here's what it does: it iterates through the enclave pages contained within [start, end) to verify that the permissions requested by a subset of {VM_READ, VM_WRITE, VM_EXEC} do not contain any permissions that are not contained in the build time permissions of any of the enclave pages within the given address range. πŸ’€

Translation for the besties: it walks every page in that range and makes sure nobody's asking for more access than what was declared way back at build time.

An enclave creator must declare the strongest permissions that will be needed for each enclave page. This ensures that mappings have the identical or weaker permissions than the earlier declared permissions. So like β€” you can't just show up later and demand more than what was originally promised, that's not how this works πŸ™ˆ


⭐ RETURN ⭐

  • 0 on success πŸŽ‰
  • -EACCES otherwise 😭 (permission said no, and honestly? fair)

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./arch/x86/kernel/cpu/sgx/encl.c β€” that's where the lore lives πŸ“–

And the whole friend group of related functions:


Ok that's the whole page, no skips, no summaries, we ate and left no crumbs πŸ’…

Later bestie β€” this one shipped from ./arch/x86/kernel/cpu/sgx and it's stamped October 2026, so mark your calendar and stan responsibly πŸŒˆπŸ’–

πŸ“¦ where this page comes from