Re: [PATCH v38 14/24] x86/sgx: Add SGX_IOC_ENCLAVE_INIT

From: Jarkko Sakkinen
Date: Thu Sep 24 2020 - 08:23:19 EST


On Wed, Sep 23, 2020 at 05:55:11PM +0200, Borislav Petkov wrote:
> On Wed, Sep 23, 2020 at 05:47:07PM +0300, Jarkko Sakkinen wrote:
> > OK, so I did not follow this particular discussion in high detail,
>
> What do you mean you did not follow it? It is not a huge subthread in
> your mbox.

I focused on other subthreads but I've read it now through. It has been
waiting in the queue. Can't do everything simultaneously. I did skim
each message as they came for this one though.

> > so as a sanity check I'll preview my changes.
>
> Sorry, but you'll have to read threads properly like everyone else.
>
> In any case, my preference would be make it the simplest possible: no
> cache and try EINIT only once.


The main reason skimming was that I was thinking that perhaps Sean might
send a patch for this one and I would then read the thread again in
better detail and check that the patch matches the conclusions, as he
has been more active on this one.

Anyway, now that I've read it through in detail, I did just change the
init simply as:

secs_addr = sgx_get_epc_addr(encl->secs.epc_page);

preempt_disable();
ret = __einit(sigstruct, token, secs_addr);
preempt_enable();

I use a local for address to make the code more readable instead of
calling sgx_get_epc_addr() inside __einit().

> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

/Jarkko