Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-14 Thread Jarkko Sakkinen
On Thu, Jun 13, 2019 at 10:14:51AM -0700, Sean Christopherson wrote: > > I don't get this. The swapper takes a read lock on mm->mmap_sem, which locks > > the vma, which in turn reference counts vma->vm_file. Why is the internal > > refcount still needed? > > mmap_sem is only held when reclaim is

Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-13 Thread Sean Christopherson
On Thu, Jun 13, 2019 at 09:47:06AM -0700, Xing, Cedric wrote: > > From: Jarkko Sakkinen [mailto:jarkko.sakki...@linux.intel.com] > > Sent: Thursday, June 13, 2019 6:48 AM > > > > On Thu, Jun 06, 2019 at 06:37:10PM +0300, Jarkko Sakkinen wrote: > > > On Wed, Jun 05, 2019 at 01:14:04PM -0700, Andy

RE: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-13 Thread Xing, Cedric
> From: Jarkko Sakkinen [mailto:jarkko.sakki...@linux.intel.com] > Sent: Thursday, June 13, 2019 6:48 AM > > On Thu, Jun 06, 2019 at 06:37:10PM +0300, Jarkko Sakkinen wrote: > > On Wed, Jun 05, 2019 at 01:14:04PM -0700, Andy Lutomirski wrote: > > > > > > > > > > On Jun 5, 2019, at 8:17 AM, Jarkko

Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-13 Thread Jarkko Sakkinen
On Thu, Jun 06, 2019 at 06:37:10PM +0300, Jarkko Sakkinen wrote: > On Wed, Jun 05, 2019 at 01:14:04PM -0700, Andy Lutomirski wrote: > > > > > > > On Jun 5, 2019, at 8:17 AM, Jarkko Sakkinen > > > wrote: > > > > > >> On Tue, Jun 04, 2019 at 10:10:22PM +, Xing, Cedric wrote: > > >> A bit

Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-06 Thread Jarkko Sakkinen
On Wed, Jun 05, 2019 at 01:14:04PM -0700, Andy Lutomirski wrote: > > > > On Jun 5, 2019, at 8:17 AM, Jarkko Sakkinen > > wrote: > > > >> On Tue, Jun 04, 2019 at 10:10:22PM +, Xing, Cedric wrote: > >> A bit off topic here. This mmap()/mprotect() discussion reminds me a > >> question (guess

Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-05 Thread Andy Lutomirski
> On Jun 5, 2019, at 8:17 AM, Jarkko Sakkinen > wrote: > >> On Tue, Jun 04, 2019 at 10:10:22PM +, Xing, Cedric wrote: >> A bit off topic here. This mmap()/mprotect() discussion reminds me a >> question (guess for Jarkko): Now that vma->vm_file->private_data keeps >> a pointer to the

Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-05 Thread Jarkko Sakkinen
On Tue, Jun 04, 2019 at 10:10:22PM +, Xing, Cedric wrote: > A bit off topic here. This mmap()/mprotect() discussion reminds me a > question (guess for Jarkko): Now that vma->vm_file->private_data keeps > a pointer to the enclave, why do we store it again in vma->vm_private? > It isn't a big

Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-05 Thread Jarkko Sakkinen
On Tue, Jun 04, 2019 at 01:16:04PM -0700, Andy Lutomirski wrote: > On Tue, Jun 4, 2019 at 4:50 AM Jarkko Sakkinen > wrote: > > > > On Fri, May 31, 2019 at 04:31:52PM -0700, Sean Christopherson wrote: > > > SGX enclaves have an associated Enclave Linear Range (ELRANGE) that is > > > tracked and

Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-05 Thread Sean Christopherson
On Tue, Jun 04, 2019 at 03:10:22PM -0700, Xing, Cedric wrote: > A bit off topic here. This mmap()/mprotect() discussion reminds me a question > (guess for Jarkko): Now that vma->vm_file->private_data keeps a pointer to > the enclave, why do we store it again in vma->vm_private? It isn't a big deal

RE: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-04 Thread Xing, Cedric
> From: linux-sgx-ow...@vger.kernel.org [mailto:linux-sgx- > ow...@vger.kernel.org] On Behalf Of Andy Lutomirski > Sent: Tuesday, June 04, 2019 1:16 PM > > On Tue, Jun 4, 2019 at 4:50 AM Jarkko Sakkinen > wrote: > > > > On Fri, May 31, 2019 at 04:31:52PM -0700, Sean Christopherson wrote: > > >

Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-04 Thread Andy Lutomirski
On Tue, Jun 4, 2019 at 4:50 AM Jarkko Sakkinen wrote: > > On Fri, May 31, 2019 at 04:31:52PM -0700, Sean Christopherson wrote: > > SGX enclaves have an associated Enclave Linear Range (ELRANGE) that is > > tracked and enforced by the CPU using a base+mask approach, similar to > > how hardware

Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-06-04 Thread Jarkko Sakkinen
On Fri, May 31, 2019 at 04:31:52PM -0700, Sean Christopherson wrote: > SGX enclaves have an associated Enclave Linear Range (ELRANGE) that is > tracked and enforced by the CPU using a base+mask approach, similar to > how hardware range registers such as the variable MTRRs. As a result, > the

[RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address

2019-05-31 Thread Sean Christopherson
SGX enclaves have an associated Enclave Linear Range (ELRANGE) that is tracked and enforced by the CPU using a base+mask approach, similar to how hardware range registers such as the variable MTRRs. As a result, the ELRANGE must be naturally sized and aligned. To reduce boilerplate code that