summaryrefslogtreecommitdiff
path: root/arch/x86/include/uapi
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2022-05-10 21:08:53 +0300
committerDave Hansen <dave.hansen@linux.intel.com>2022-07-07 20:13:03 +0300
commit7b013e723a1f689077347b30778d8831b6d92969 (patch)
tree5976c679153b8f7fa55743757102b68d6f7497a7 /arch/x86/include/uapi
parent5a90d2c3f5ef87717e54572af8426aba6fdbdaa6 (diff)
downloadlinux-7b013e723a1f689077347b30778d8831b6d92969.tar.xz
x86/sgx: Tighten accessible memory range after enclave initialization
Before an enclave is initialized the enclave's memory range is unknown. The enclave's memory range is learned at the time it is created via the SGX_IOC_ENCLAVE_CREATE ioctl() where the provided memory range is obtained from an earlier mmap() of /dev/sgx_enclave. After an enclave is initialized its memory can be mapped into user space (mmap()) from where it can be entered at its defined entry points. With the enclave's memory range known after it is initialized there is no reason why it should be possible to map memory outside this range. Lock down access to the initialized enclave's memory range by denying any attempt to map memory outside its memory range. Locking down the memory range also makes adding pages to an initialized enclave more efficient. Pages are added to an initialized enclave by accessing memory that belongs to the enclave's memory range but not yet backed by an enclave page. If it is possible for user space to map memory that does not form part of the enclave then an access to this memory would eventually fail. Failures range from a prompt general protection fault if the access was an ENCLU[EACCEPT] from within the enclave, or a page fault via the vDSO if it was another access from within the enclave, or a SIGBUS (also resulting from a page fault) if the access was from outside the enclave. Disallowing invalid memory to be mapped in the first place avoids preventable failures. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lkml.kernel.org/r/6391460d75ae79cea2e81eef0f6ffc03c6e9cfe7.1652137848.git.reinette.chatre@intel.com
Diffstat (limited to 'arch/x86/include/uapi')
0 files changed, 0 insertions, 0 deletions