summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cpu/sgx/sgx.h
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko@kernel.org>2020-11-13 01:01:24 +0300
committerBorislav Petkov <bp@suse.de>2020-11-18 20:02:49 +0300
commitc6d26d370767fa227fc44b98a8bdad112efdf563 (patch)
tree2a85046051ce019defd36e5adfc6c1b2bb76c1d7 /arch/x86/kernel/cpu/sgx/sgx.h
parent888d249117876239593fe3039b6ead8ad6849035 (diff)
downloadlinux-c6d26d370767fa227fc44b98a8bdad112efdf563.tar.xz
x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES
SGX enclave pages are inaccessible to normal software. They must be populated with data by copying from normal memory with the help of the EADD and EEXTEND functions of the ENCLS instruction. Add an ioctl() which performs EADD that adds new data to an enclave, and optionally EEXTEND functions that hash the page contents and use the hash as part of enclave “measurement” to ensure enclave integrity. The enclave author gets to decide which pages will be included in the enclave measurement with EEXTEND. Measurement is very slow and has sometimes has very little value. For instance, an enclave _could_ measure every page of data and code, but would be slow to initialize. Or, it might just measure its code and then trust that code to initialize the bulk of its data after it starts running. Co-developed-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Borislav Petkov <bp@suse.de> Tested-by: Jethro Beekman <jethro@fortanix.com> Link: https://lkml.kernel.org/r/20201112220135.165028-14-jarkko@kernel.org
Diffstat (limited to 'arch/x86/kernel/cpu/sgx/sgx.h')
-rw-r--r--arch/x86/kernel/cpu/sgx/sgx.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
index bd9dcb1ffcfa..91234f425b89 100644
--- a/arch/x86/kernel/cpu/sgx/sgx.h
+++ b/arch/x86/kernel/cpu/sgx/sgx.h
@@ -14,6 +14,7 @@
#define pr_fmt(fmt) "sgx: " fmt
#define SGX_MAX_EPC_SECTIONS 8
+#define SGX_EEXTEND_BLOCK_SIZE 256
struct sgx_epc_page {
unsigned int section;