Re: [PATCH v39 13/24] x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES

2020-10-23 Thread Jarkko Sakkinen
On Mon, Oct 19, 2020 at 02:44:19PM -0700, Dave Hansen wrote: > On 10/19/20 2:15 PM, Sean Christopherson wrote: > Yeah... Don't we need to do another access_ok() check here, if we > needed one above since we are moving away from addrp.src? > >>> I don't think so because the page is

Re: [PATCH v39 13/24] x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES

2020-10-19 Thread Dave Hansen
On 10/19/20 2:15 PM, Sean Christopherson wrote: Yeah... Don't we need to do another access_ok() check here, if we needed one above since we are moving away from addrp.src? >>> I don't think so because the page is pinned with get_user_pages(). >> No, get_user_pages() is orthogonal. >> >>

Re: [PATCH v39 13/24] x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES

2020-10-19 Thread Sean Christopherson
On Mon, Oct 19, 2020 at 01:48:32PM -0700, Dave Hansen wrote: > On 10/17/20 10:03 PM, Jarkko Sakkinen wrote: > >>> + if (ret) { > >>> + if (encls_failed(ret)) > >>> + ENCLS_WARN(ret, "EEXTEND"); > >>> + return -EIO; > >> > >> How

Re: [PATCH v39 13/24] x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES

2020-10-19 Thread Dave Hansen
On 10/17/20 10:03 PM, Jarkko Sakkinen wrote: > On Fri, Oct 16, 2020 at 02:25:50PM -0700, Dave Hansen wrote: >>> +/** >>> + * struct sgx_enclave_add_pages - parameter structure for the >>> + *%SGX_IOC_ENCLAVE_ADD_PAGE ioctl >>> + * @src: start address for the page

Re: [PATCH v39 13/24] x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES

2020-10-19 Thread Jarkko Sakkinen
On Sun, Oct 18, 2020 at 08:03:11AM +0300, Jarkko Sakkinen wrote: > > > + mmap_read_lock(current->mm); > > > + mutex_lock(>lock); > > > + > > > + /* > > > + * Insert prior to EADD in case of OOM. > > > > I wouldn't say OOM. Maybe: > > > > xa_insert() and EADD can both fail. But xa_insert()

Re: [PATCH v39 13/24] x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES

2020-10-17 Thread Jarkko Sakkinen
On Fri, Oct 16, 2020 at 02:25:50PM -0700, Dave Hansen wrote: > > > +/** > > + * struct sgx_enclave_add_pages - parameter structure for the > > + *%SGX_IOC_ENCLAVE_ADD_PAGE ioctl > > + * @src: start address for the page data > > + * @offset:starting page

Re: [PATCH v39 13/24] x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES

2020-10-16 Thread Dave Hansen
> +/** > + * struct sgx_enclave_add_pages - parameter structure for the > + *%SGX_IOC_ENCLAVE_ADD_PAGE ioctl > + * @src: start address for the page data > + * @offset: starting page offset Is this the offset *within* the page? Might be nice to say that. >

[PATCH v39 13/24] x86/sgx: Add SGX_IOC_ENCLAVE_ADD_PAGES

2020-10-02 Thread Jarkko Sakkinen
Add an ioctl, which performs ENCLS[EADD] that adds new visible page to an enclave, and optionally ENCLS[EEXTEND] operations that hash the page to the enclave measurement. By visible we mean a page that can be mapped to the address range of an enclave. Acked-by: Jethro Beekman Tested-by: Jethro