lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 5 Oct 2018 14:32:44 +0300
From:   Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To:     Sean Christopherson <sean.j.christopherson@...el.com>
Cc:     x86@...nel.org, platform-driver-x86@...r.kernel.org,
        dave.hansen@...el.com, nhorman@...hat.com, npmccallum@...hat.com,
        serge.ayoun@...el.com, shay.katz-zamir@...el.com,
        linux-sgx@...r.kernel.org, andriy.shevchenko@...ux.intel.com,
        Suresh Siddha <suresh.b.siddha@...el.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        Darren Hart <dvhart@...radead.org>,
        Andy Shevchenko <andy@...radead.org>,
        "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" 
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v14 15/19] platform/x86: Intel SGX driver

On Thu, Oct 04, 2018 at 11:01:17AM -0700, Sean Christopherson wrote:
> On Tue, 2018-09-25 at 16:06 +0300, 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.
> > 
> > SGX driver provides a ioctl API for loading and initializing enclaves.
> > Address range for enclaves is reserved with mmap() and they are
> > destroyed with munmap(). Enclave construction, measurement and
> > initialization is done with the provided the ioctl API.
> 
> ...
> 
> > +/**
> > + * sgx_ioc_enclave_init - handler for %SGX_IOC_ENCLAVE_INIT
> > + *
> > + * @filep:	open file to /dev/sgx
> > + * @cmd:	the command value
> > + * @arg:	pointer to an &sgx_enclave_init instance
> > + *
> > + * Flushes the remaining enqueued EADD operations and performs EINIT. Does not
> > + * allow the EINITTOKENKEY attribute for an enclave.
> > + *
> > + * Return:
> > + *   0 on success,
> > + *   SGX error code on EINIT failure,
> > + *   -errno otherwise
> > + */
> > +static long sgx_ioc_enclave_init(struct file *filep, unsigned int cmd,
> > +				 unsigned long arg)
> > +{
> > +	struct sgx_enclave_init *initp = (struct sgx_enclave_init *)arg;
> > +	struct sgx_sigstruct *sigstruct;
> > +	struct sgx_einittoken *einittoken;
> > +	struct sgx_encl *encl;
> > +	struct page *initp_page;
> > +	int ret;
> > +
> > +	initp_page = alloc_page(GFP_HIGHUSER);
> > +	if (!initp_page)
> > +		return -ENOMEM;
> > +
> > +	sigstruct = kmap(initp_page);
> > +	einittoken = (struct sgx_einittoken *)
> > +		((unsigned long)sigstruct + PAGE_SIZE / 2);
> > +	memset(einittoken, 0, sizeof(*einittoken));
> > +
> > +	ret = copy_from_user(sigstruct, (void __user *)initp->sigstruct,
> > +			     sizeof(*sigstruct));
> > +	if (ret)
> > +		goto out;
> > +	if (sigstruct->attributes & SGX_ATTR_EINITTOKENKEY) {
> > +		ret = EINVAL;
> 
> This should be "ret = -EINVAL".

Ouch :-( Thank you for spotting this out.

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ