Re: [RFC PATCH v4 2/4] x86/sgx: Implement support for MADV_WILLNEED

jarkko
2023-03-19T13:26:18Z

On Tue, Mar 14, 2023 at 09:54:30AM -0500, Haitao Huang wrote:
> On Thu, 09 Mar 2023 05:31:29 -0600, Huang, Kai <kai.huang@intel.com> wrote:
> > >
> > > Then in v29, PROT_NONE mapping was disallowed for encl_fd before pages
> > > EADDed so user space has to mmap anonymously to reserve the range.The
> > > intent was still not to allow mmap before pages EADDed (the !page check
> > > was still there up to v38)
> >
> > Do you know the reason of disallowing PROT_NONE mapping against encl_fd?
> >
>
> I think it was to allow user space to do anonymous mapping to reserve
> address space for enclave.
> Before this point, you have to use PROT_NONE to reserve with encl_fd. There
> might be an issue with how #PF and EPC swapping was handled or the elegance
> of those flows that motivated the move but I can't remember. ABI was not
> fixed at that time so it was OK to change.

Yes, this was done because enclave naturally aligned base address.

BR, Jarkko