Re: [RFC PATCH v2 2/5] x86/sgx: Require userspace to define enclave pages' protection bits
From: Jarkko Sakkinen
Date: Mon Jun 10 2019 - 13:49:53 EST
On Mon, Jun 10, 2019 at 09:15:33AM -0700, Sean Christopherson wrote:
> > 'flags' should would renamed as 'secinfo_flags_mask' even if the name is
> > longish. It would use the same values as the SECINFO flags. The field in
> > struct sgx_encl_page should have the same name. That would express
> > exactly relation between SECINFO and the new field. I would have never
> > asked on last iteration why SECINFO is not enough with a better naming.
>
> No, these flags do not impact the EPCM protections in any way. Userspace
> can extend the EPCM protections without going through the kernel. The
> protection flags for an enclave page impact VMA/PTE protection bits.
>
> IMO, it is best to treat the EPCM as being completely separate from the
> kernel's EPC management.
It is a clumsy API if permissions are not taken in the same format for
everything. There is no reason not to do it. The way mprotect() callback
just interprets the field is as VMA permissions.
It would also be more future-proof just to have a mask covering all bits
of the SECINFO flags field.
/Jarkko