Re: [PATCH] x86/sgx: Remove PROT_NONE branch from sgx_encl_may_map().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 17, 2020 at 09:37:49PM -0700, Sean Christopherson wrote:
> On Tue, Mar 31, 2020 at 12:13:36AM +0300, Jarkko Sakkinen wrote:
> > On Mon, Mar 30, 2020 at 09:54:52PM +0300, Jarkko Sakkinen wrote:
> > > sgx_encl_may_map() always succeeding when PROT_NONE is given is not that
> > > useful behaviour as one can just well as do an anonymous mapping as
> > > demonstrated by the change in this patch to the test program. As a
> > > consequence, remove the special case.
> > > 
> > > Pratically any possible way to make sure that you don't overwrite anything
> > > useful in the memory, should be fine. MAP_FIXED does not care what's
> > > underneath (if you want't it to care you ought to use
> > > MAP_FIXED_NO_REPLACE).
> > > 
> > > After this change, the selftest run called sgx_mmap() only three times
> > > (TCS, text, data) instead of four.
> > > 
> > >         test_sgx-1811  [002] ....   586.907585: sgx_mmap <-mmap_region
> > >         test_sgx-1811  [002] ....   586.911752: sgx_mmap <-mmap_region
> > >         test_sgx-1811  [002] ....   586.911756: sgx_mmap <-mmap_region
> > > 
> > > This also gives more angles to segregate enclave building and mapping as
> > > the mmap()'s need to be applied only when the enclave is fully built:
> > > 
> > > Cc: luto@xxxxxxxxxx
> > > Cc: Haitao Huang <haitao.huang@xxxxxxxxxxxxxxx>
> > > Cc: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
> > > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>
> > 
> > Sean, would be cool if you can try this out soonish because I'm
> > building on top of this.
> 
> Two and a half weeks is soonish, right?
> 
> Anyways, finally tested this, no issues.  Just to be different than the
> selftest, I used MAP_PRIVATE instead of MAP_SHARED along with MAP_ANONYMOUS
> in my test code.

Ah, MAP_SHARED was not intentional. Not gonna change it tho because both
should equally work (or basically anything to guarante the availability
of the address space).

/Jarkko



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux