NE_SET_USER_MEMORY_REGION(9)
π NE_SET_USER_MEMORY_REGION(9) π
okay so bestie, welcome to the NE_SET_USER_MEMORY_REGION(9) page from the Kernel API Manual π
this is the enclave memory-region lore and it is lowkey important β¨
πΈ NAME πΈ
NE_SET_USER_MEMORY_REGION β the command is used to set a memory region for an enclave, given the allocated memory from the userspace. Enclave memory needs to be from the same NUMA node as the enclave CPUs. The user memory region is an input parameter. It includes info provided by the caller β flags, memory size and userspace address. The ioctl can be invoked on the enclave fd, before an enclave is started. no cap π«Ά
β¨ SYNOPSIS β¨
NE_SET_USER_MEMORY_REGION
π¦ CONTEXT π¦
Process context. that's it, that's the vibe π
π₯ RETURN π₯
0β Logic successfully completed. slay β¨-1β There was a failure in the ioctl logic. On failure,errnois set to: πEFAULTβcopy_from_userfailure.EINVALβ Invalid physical memory region(s) e.g. unaligned address.EIOβ Current task mm is not the same as the one that created the enclave.ENOMEMβ Memory allocation failure for internal bookkeeping variables.NE_ERR_NOT_IN_INIT_STATEβ The enclave is not in init state (init= before being started).NE_ERR_INVALID_MEM_REGION_SIZEβ The memory size of the region is not multiple of2 MiB.NE_ERR_INVALID_MEM_REGION_ADDRβ Invalid user space address given.NE_ERR_UNALIGNED_MEM_REGION_ADDRβ Unaligned user space address given.NE_ERR_MEM_REGION_ALREADY_USEDβ The memory region is already used.NE_ERR_MEM_NOT_HUGE_PAGEβ The memory region is not backed by huge pages.NE_ERR_MEM_DIFFERENT_NUMA_NODEβ The memory region is not from the same NUMA node as the CPUs.NE_ERR_MEM_MAX_REGIONSβ The number of memory regions set for the enclave reached maximum.NE_ERR_INVALID_PAGE_SIZEβ The memory region is not backed by pages multiple of2 MiB.NE_ERR_INVALID_FLAG_VALUEβ The value of the provided flag is invalid.- Error codes from
get_user_pages. - Error codes from the NE PCI device request.
π SEE ALSO π
- Kernel file
./include/uapi/linux/nitro_enclaves.h Nitro Enclaves (NE) Kernel Driver Interface(9)NE_CREATE_VM(9)NE_ADD_VCPU(9)NE_GET_IMAGE_LOAD_INFO(9)NE_START_ENCLAVE(9)NE specific error codes(9)NE_ERR_VCPU_ALREADY_USED(9)NE_ERR_VCPU_NOT_IN_CPU_POOL(9)NE_ERR_VCPU_INVALID_CPU_CORE(9)NE_ERR_INVALID_MEM_REGION_SIZE(9)NE_ERR_INVALID_MEM_REGION_ADDR(9)NE_ERR_UNALIGNED_MEM_REGION_ADDR(9)NE_ERR_MEM_REGION_ALREADY_USED(9)NE_ERR_MEM_NOT_HUGE_PAGE(9)NE_ERR_MEM_DIFFERENT_NUMA_NODE(9)NE_ERR_MEM_MAX_REGIONS(9)NE_ERR_NO_MEM_REGIONS_ADDED(9)NE_ERR_NO_VCPUS_ADDED(9)NE_ERR_ENCLAVE_MEM_MIN_SIZE(9)NE_ERR_FULL_CORES_NOT_USED(9)NE_ERR_NOT_IN_INIT_STATE(9)NE_ERR_INVALID_VCPU(9)NE_ERR_NO_CPUS_AVAIL_IN_POOL(9)NE_ERR_INVALID_PAGE_SIZE(9)NE_ERR_INVALID_FLAG_VALUE(9)NE_ERR_INVALID_ENCLAVE_CID(9)Image load info flags(9)NE_EIF_IMAGE(9)struct ne_image_load_info(9)User memory region flags(9)NE_DEFAULT_MEMORY_REGION(9)struct ne_user_memory_region(9)Enclave start info flags(9)NE_ENCLAVE_PRODUCTION_MODE(9)NE_ENCLAVE_DEBUG_MODE(9)struct ne_enclave_start_info(9)
and that's the page, bestie π«Ά source/version: ./include/uapi/linux, date: October 2026, page: NE_SET_USER_MEMORY_REGION(9) β periodt π
π¦ 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