Re: [PATCH v38 12/24] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE

2020-10-02 Thread Jarkko Sakkinen
On Fri, Oct 02, 2020 at 07:23:55PM -0500, Haitao Huang wrote: > On Tue, 15 Sep 2020 06:28:30 -0500, Jarkko Sakkinen > wrote: > > > Add an ioctl that performs ENCLS[ECREATE], which creates SGX Enclave > > Control Structure for the enclave. SECS contains attributes about the > > enclave that are us

Re: [PATCH v38 12/24] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE

2020-10-02 Thread Haitao Huang
On Tue, 15 Sep 2020 06:28:30 -0500, Jarkko Sakkinen wrote: Add an ioctl that performs ENCLS[ECREATE], which creates SGX Enclave Control Structure for the enclave. SECS contains attributes about the enclave that are used by the hardware and cannot be directly accessed by software, as SECS resi

Re: [PATCH v38 12/24] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE

2020-09-21 Thread Jarkko Sakkinen
On Mon, Sep 21, 2020 at 03:51:07PM +0200, Borislav Petkov wrote: > > "... after checking that the provided data for SECS meets the expectations > > of ENCLS[ECREATE] for an unitialized enclave and size of the address There is a typo (should be uninitialized). > > Is this sufficient for you, or do

Re: [PATCH v38 12/24] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE

2020-09-21 Thread Borislav Petkov
On Mon, Sep 21, 2020 at 03:28:23PM +0300, Jarkko Sakkinen wrote: > Is this appropriate: > > /* The extra page in swap space goes to SECS. */ > encl_size = secs->size + PAGE_SIZE; > > backing = shmem_file_setup("SGX backing", encl_size + (encl_size >> 5), >

Re: [PATCH v38 12/24] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE

2020-09-21 Thread Jarkko Sakkinen
On Mon, Sep 21, 2020 at 12:03:56PM +0200, Borislav Petkov wrote: > On Tue, Sep 15, 2020 at 02:28:30PM +0300, Jarkko Sakkinen wrote: > > +static int sgx_validate_secs(const struct sgx_secs *secs) > > +{ > > + u64 max_size = (secs->attributes & SGX_ATTR_MODE64BIT) ? > > + sgx_encl_

Re: [PATCH v38 12/24] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE

2020-09-21 Thread Borislav Petkov
On Tue, Sep 15, 2020 at 02:28:30PM +0300, Jarkko Sakkinen wrote: > +static int sgx_validate_secs(const struct sgx_secs *secs) > +{ > + u64 max_size = (secs->attributes & SGX_ATTR_MODE64BIT) ? > +sgx_encl_size_max_64 : sgx_encl_size_max_32; > + > + if (secs->size < (2 * P

[PATCH v38 12/24] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE

2020-09-15 Thread Jarkko Sakkinen
Add an ioctl that performs ENCLS[ECREATE], which creates SGX Enclave Control Structure for the enclave. SECS contains attributes about the enclave that are used by the hardware and cannot be directly accessed by software, as SECS resides in the EPC. One essential field in SECS is a field that stor

[PATCH v38 12/24] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE

2020-09-15 Thread Jarkko Sakkinen
Add an ioctl that performs ENCLS[ECREATE], which creates SGX Enclave Control Structure for the enclave. SECS contains attributes about the enclave that are used by the hardware and cannot be directly accessed by software, as SECS resides in the EPC. One essential field in SECS is a field that stor