Re: [PATCH v19,RESEND 16/27] x86/sgx: Add the Linux SGX Enclave Driver

From: Huang, Kai
Date: Tue Mar 26 2019 - 08:01:39 EST


On Wed, 2019-03-20 at 18:21 +0200, Jarkko Sakkinen wrote:
> Intel Software Guard eXtensions (SGX) is a set of CPU instructions that
> can be used by applications to set aside private regions of code and
> data. The code outside the enclave is disallowed to access the memory
> inside the enclave by the CPU access control.
>
> This commit adds the Linux SGX Enclave Driver that provides an ioctl API
> to manage enclaves. The address range for an enclave, commonly referred
> as ELRANGE in the documentation (e.g. Intel SDM), is reserved with
> mmap() against /dev/sgx. After that a set ioctls is used to build
> the enclave to the ELRANGE.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>
> Co-developed-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
> Co-developed-by: Serge Ayoun <serge.ayoun@xxxxxxxxx>
> Signed-off-by: Serge Ayoun <serge.ayoun@xxxxxxxxx>
> Co-developed-by: Shay Katz-zamir <shay.katz-zamir@xxxxxxxxx>
> Signed-off-by: Shay Katz-zamir <shay.katz-zamir@xxxxxxxxx>
> Co-developed-by: Suresh Siddha <suresh.b.siddha@xxxxxxxxx>
> Signed-off-by: Suresh Siddha <suresh.b.siddha@xxxxxxxxx>
> ---
> Documentation/ioctl/ioctl-number.txt | 1 +
> arch/x86/Kconfig | 17 +-
> arch/x86/include/uapi/asm/sgx.h | 59 ++
> arch/x86/kernel/cpu/sgx/Makefile | 5 +-
> arch/x86/kernel/cpu/sgx/driver/Makefile | 3 +
> arch/x86/kernel/cpu/sgx/driver/driver.h | 38 ++
> arch/x86/kernel/cpu/sgx/driver/ioctl.c | 795 ++++++++++++++++++++++++
> arch/x86/kernel/cpu/sgx/driver/main.c | 290 +++++++++
> arch/x86/kernel/cpu/sgx/encl.c | 358 +++++++++++
> arch/x86/kernel/cpu/sgx/encl.h | 88 +++
> arch/x86/kernel/cpu/sgx/encls.c | 1 +
> arch/x86/kernel/cpu/sgx/main.c | 3 +
> arch/x86/kernel/cpu/sgx/sgx.h | 1 +
> 13 files changed, 1657 insertions(+), 2 deletions(-)
> create mode 100644 arch/x86/include/uapi/asm/sgx.h
> create mode 100644 arch/x86/kernel/cpu/sgx/driver/Makefile
> create mode 100644 arch/x86/kernel/cpu/sgx/driver/driver.h
> create mode 100644 arch/x86/kernel/cpu/sgx/driver/ioctl.c
> create mode 100644 arch/x86/kernel/cpu/sgx/driver/main.c
> create mode 100644 arch/x86/kernel/cpu/sgx/encl.c
> create mode 100644 arch/x86/kernel/cpu/sgx/encl.h

Shouldn't the driver be located somewhere under drivers/, but not under arch/x86?

I don't think x86 maintainers should have the burden to review every code change made to SGX driver?

Thanks,
-Kai