linux-sgx.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: linux-sgx@vger.kernel.org
Cc: luto@kernel.org, Haitao Huang <haitao.huang@linux.intel.com>,
	Sean Christopherson <sean.j.christopherson@intel.com>
Subject: Re: [PATCH] x86/sgx: Remove PROT_NONE branch from sgx_encl_may_map().
Date: Tue, 31 Mar 2020 00:13:36 +0300	[thread overview]
Message-ID: <20200330211320.GA1389628@linux.intel.com> (raw)
In-Reply-To: <20200330185452.1382455-1-jarkko.sakkinen@linux.intel.com>

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@kernel.org
> Cc: Haitao Huang <haitao.huang@linux.intel.com>
> Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

Sean, would be cool if you can try this out soonish because I'm
building on top of this.

I tried you vdso change on a GLK NUC and they seem to work.

/Jarkko

  reply	other threads:[~2020-03-30 21:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 18:54 [PATCH] x86/sgx: Remove PROT_NONE branch from sgx_encl_may_map() Jarkko Sakkinen
2020-03-30 21:13 ` Jarkko Sakkinen [this message]
2020-04-18  4:37   ` Sean Christopherson
2020-04-20 21:51     ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200330211320.GA1389628@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=haitao.huang@linux.intel.com \
    --cc=linux-sgx@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=sean.j.christopherson@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).