linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-sgx@vger.kernel.org, akpm@linux-foundation.org,
	dave.hansen@intel.com, sean.j.christopherson@intel.com,
	nhorman@redhat.com, npmccallum@redhat.com, serge.ayoun@intel.com,
	shay.katz-zamir@intel.com, haitao.huang@intel.com,
	andriy.shevchenko@linux.intel.com, tglx@linutronix.de,
	kai.svahn@intel.com, bp@alien8.de, josh@joshtriplett.org,
	luto@kernel.org, kai.huang@intel.com, rientjes@google.com,
	cedric.xing@intel.com, puiterwijk@redhat.com,
	linux-security-module@vger.kernel.org,
	Suresh Siddha <suresh.b.siddha@intel.com>
Subject: Re: [PATCH v23 12/24] x86/sgx: Linux Enclave Driver
Date: Fri, 1 Nov 2019 09:28:17 -0400	[thread overview]
Message-ID: <4bf866ae-adc8-7902-3714-b62e548d8584@tycho.nsa.gov> (raw)
In-Reply-To: <f91d788c-b372-8e2f-7ffb-995f501b5d6b@tycho.nsa.gov>

On 11/1/19 9:16 AM, Stephen Smalley wrote:
> On 10/31/19 5:17 PM, Jarkko Sakkinen wrote:
>> On Wed, Oct 30, 2019 at 09:45:05AM -0400, Stephen Smalley wrote:
>>> On 10/28/19 5:03 PM, Jarkko Sakkinen wrote:
>>>> Intel Software Guard eXtensions (SGX) is a set of CPU instructions that
>>>> can be used by applications to set aside private regions of code and
>>>> data. The code outside the SGX hosted software entity is disallowed to
>>>> access the memory inside the enclave enforced by the CPU. We call these
>>>> entities as enclaves.
>>>>
>>>> This commit implements a driver that provides an ioctl API to construct
>>>> and run enclaves. Enclaves are constructed from pages residing in
>>>> reserved physical memory areas. The contents of these pages can only be
>>>> accessed when they are mapped as part of an enclave, by a hardware
>>>> thread running inside the enclave.
>>>>
>>>> The starting state of an enclave consists of a fixed measured set of
>>>> pages that are copied to the EPC during the construction process by
>>>> using ENCLS leaf functions and Software Enclave Control Structure 
>>>> (SECS)
>>>> that defines the enclave properties.
>>>>
>>>> Enclave are constructed by using ENCLS leaf functions ECREATE, EADD and
>>>> EINIT. ECREATE initializes SECS, EADD copies pages from system 
>>>> memory to
>>>> the EPC and EINIT check a given signed measurement and moves the 
>>>> enclave
>>>> into a state ready for execution.
>>>>
>>>> An initialized enclave can only be accessed through special Thread 
>>>> Control
>>>> Structure (TCS) pages by using ENCLU (ring-3 only) leaf EENTER.  
>>>> This leaf
>>>> function converts a thread into enclave mode and continues the 
>>>> execution in
>>>> the offset defined by the TCS provided to EENTER. An enclave is exited
>>>> through syscall, exception, interrupts or by explicitly calling another
>>>> ENCLU leaf EEXIT.
>>>>
>>>> The permissions, which enclave page is added will set the limit for 
>>>> maximum
>>>> permissions that can be set for mmap() and mprotect(). This will
>>>> effectively allow to build different security schemes between 
>>>> producers and
>>>> consumers of enclaves. Later on we can increase granularity with LSM 
>>>> hooks
>>>> for page addition (i.e. for producers) and mapping of the enclave 
>>>> (i.e. for
>>>> consumers)
>>>
>>> Where do things stand wrt to ensuring that SGX cannot be used to 
>>> introduce
>>> executable mappings that were never authorized by the LSM (or never 
>>> measured
>>> by IMA)?
>>
>> This was the latest discussion about that subject:
>>
>> https://lore.kernel.org/linux-sgx/CALCETrWDLX68Vi4=9Dicq9ATmJ5mv36bzrc02heNYaHaBeWumQ@mail.gmail.com/ 
>>
> 
> So, IIUC, that means that merging the driver will create a regression 
> with respect to LSM control over executable mappings that will only be 
> rectified at some future point in time if/when someone submits LSM hooks 
> or calls to existing hooks to restore such control.  That doesn't seem 
> like a good idea.  Why can't you include at least that basic level of 
> control now?  It is one thing to defer finer grained control or 
> SGX-specific access controls to the future - that I can understand.  But 
> introducing a regression in the existing controls is not really ok.

Unless you are arguing that the existing checks on mmap/mprotect of 
/dev/sgx/enclave are a coarse-grained approximation (effectively 
requiring WX to the file or execmem for any user of SGX).


  reply	other threads:[~2019-11-01 13:28 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 21:03 [PATCH v23 00/24] Intel SGX foundations Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 01/24] x86/sgx: Update MAINTAINERS Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 02/24] x86/cpufeatures: x86/msr: Add Intel SGX hardware bits Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 03/24] x86/cpufeatures: x86/msr: Intel SGX Launch Control " Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 04/24] x86/mm: x86/sgx: Signal SIGSEGV with PF_SGX Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 05/24] x86/sgx: Add SGX microarchitectural data structures Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 06/24] x86/sgx: Add wrappers for ENCLS leaf functions Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 07/24] x86/cpu/intel: Detect SGX supprt Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 08/24] x86/sgx: Enumerate and track EPC sections Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 09/24] x86/sgx: Add functions to allocate and free EPC pages Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 10/24] x86/sgx: Add sgx_einit() for wrapping ENCLS[EINIT] Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 11/24] mm: Introduce vm_ops->may_mprotect() Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 12/24] x86/sgx: Linux Enclave Driver Jarkko Sakkinen
2019-10-29  9:29   ` Jarkko Sakkinen
2019-10-30  9:30     ` Sean Christopherson
2019-10-31 21:12       ` Jarkko Sakkinen
2019-11-05 11:11         ` Jarkko Sakkinen
2019-11-08  8:20           ` Jarkko Sakkinen
2019-10-30 13:45   ` Stephen Smalley
2019-10-31 21:17     ` Jarkko Sakkinen
2019-11-01 13:16       ` Stephen Smalley
2019-11-01 13:28         ` Stephen Smalley [this message]
2019-11-01 15:32           ` Sean Christopherson
2019-11-01 17:16             ` Stephen Smalley
2019-11-08  8:05               ` Jarkko Sakkinen
2019-11-28 18:24   ` Greg KH
2019-12-06 20:38     ` Jarkko Sakkinen
2019-12-07  8:09       ` Greg KH
2019-12-09 19:57         ` Jarkko Sakkinen
2019-12-23 11:01           ` Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 13/24] selftests/x86: Recurse into subdirectories Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 14/24] selftests/x86: Add a selftest for SGX Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 15/24] x86/sgx: Add provisioning Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 16/24] x86/sgx: Add a page reclaimer Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 17/24] x86/sgx: ptrace() support for the SGX driver Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 18/24] x86/vdso: Add support for exception fixup in vDSO functions Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 19/24] x86/fault: Add helper function to sanitize error code Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 20/24] x86/traps: Attempt to fixup exceptions in vDSO before signaling Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 21/24] x86/vdso: Add __vdso_sgx_enter_enclave() to wrap SGX enclave transitions Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 22/24] selftests/x86: Add vDSO selftest for SGX Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 23/24] docs: x86/sgx: Document microarchitecture Jarkko Sakkinen
2019-10-28 21:03 ` [PATCH v23 24/24] docs: x86/sgx: Document kernel internals Jarkko Sakkinen
2019-11-21 15:08 ` [PATCH v23 00/24] Intel SGX foundations Nathaniel McCallum
2019-11-27 21:01   ` 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=4bf866ae-adc8-7902-3714-b62e548d8584@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=cedric.xing@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=haitao.huang@intel.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=josh@joshtriplett.org \
    --cc=kai.huang@intel.com \
    --cc=kai.svahn@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=nhorman@redhat.com \
    --cc=npmccallum@redhat.com \
    --cc=puiterwijk@redhat.com \
    --cc=rientjes@google.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=serge.ayoun@intel.com \
    --cc=shay.katz-zamir@intel.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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).