* [PATCH for_v21] docs: x86/sgx: Add a blurb on basic EPC management to 'kernel internals'
@ 2019-07-11 21:44 Sean Christopherson
2019-07-12 3:47 ` Jarkko Sakkinen
0 siblings, 1 reply; 2+ messages in thread
From: Sean Christopherson @ 2019-07-11 21:44 UTC (permalink / raw)
To: Jarkko Sakkinen; +Cc: linux-sgx
Add a section on how EPC is managed and why.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
Documentation/x86/sgx/2.Kernel-internals.rst | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/Documentation/x86/sgx/2.Kernel-internals.rst b/Documentation/x86/sgx/2.Kernel-internals.rst
index de359bf605ca..5c90a65936f2 100644
--- a/Documentation/x86/sgx/2.Kernel-internals.rst
+++ b/Documentation/x86/sgx/2.Kernel-internals.rst
@@ -15,6 +15,26 @@ attempt to play nice in the face of a misconfigured system. With the exception
of Launch Control's hash MSRs, which can vary per CPU, Linux assumes that all
CPUs have a configuration that is identical to the boot CPU.
+EPC management
+==============
+
+Because the kernel can't arbitrarily read EPC memory or share RO backing pages
+between enclaves, traditional memory models such as CoW and fork() do not work
+with enclaves. In other words, the architectural rules of EPC forces it to be
+treated as MAP_SHARED at all times.
+
+The inability to employ traditional memory models also means that EPC memory
+must be isolated from normal memory pools, e.g. attempting to use EPC memory
+for normal mappings would result in faults and/or perceived data corruption.
+Furthermore, EPC is not enumerated by as normal memory, e.g. BIOS enumerates
+EPC as reserved memory in the e820 tables, or not at all. As a result, EPC
+memory is directly managed by the SGX subsystem, e.g. SGX employs VM_PFNMAP to
+manually insert/zap/swap page table entries, and exposes EPC to userspace via
+a well known device, /dev/sgx/enclave.
+
+The net effect is that all enclave VMAs must be MAP_SHARED and are backed by
+a single file, /dev/sgx/enclave.
+
EPC oversubscription
====================
--
2.22.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for_v21] docs: x86/sgx: Add a blurb on basic EPC management to 'kernel internals'
2019-07-11 21:44 [PATCH for_v21] docs: x86/sgx: Add a blurb on basic EPC management to 'kernel internals' Sean Christopherson
@ 2019-07-12 3:47 ` Jarkko Sakkinen
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2019-07-12 3:47 UTC (permalink / raw)
To: Sean Christopherson; +Cc: linux-sgx
On Thu, Jul 11, 2019 at 02:44:17PM -0700, Sean Christopherson wrote:
> Add a section on how EPC is managed and why.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> Documentation/x86/sgx/2.Kernel-internals.rst | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/Documentation/x86/sgx/2.Kernel-internals.rst b/Documentation/x86/sgx/2.Kernel-internals.rst
> index de359bf605ca..5c90a65936f2 100644
> --- a/Documentation/x86/sgx/2.Kernel-internals.rst
> +++ b/Documentation/x86/sgx/2.Kernel-internals.rst
> @@ -15,6 +15,26 @@ attempt to play nice in the face of a misconfigured system. With the exception
> of Launch Control's hash MSRs, which can vary per CPU, Linux assumes that all
> CPUs have a configuration that is identical to the boot CPU.
>
> +EPC management
> +==============
> +
> +Because the kernel can't arbitrarily read EPC memory or share RO backing pages
> +between enclaves, traditional memory models such as CoW and fork() do not work
> +with enclaves. In other words, the architectural rules of EPC forces it to be
> +treated as MAP_SHARED at all times.
> +
> +The inability to employ traditional memory models also means that EPC memory
> +must be isolated from normal memory pools, e.g. attempting to use EPC memory
> +for normal mappings would result in faults and/or perceived data corruption.
> +Furthermore, EPC is not enumerated by as normal memory, e.g. BIOS enumerates
> +EPC as reserved memory in the e820 tables, or not at all. As a result, EPC
> +memory is directly managed by the SGX subsystem, e.g. SGX employs VM_PFNMAP to
> +manually insert/zap/swap page table entries, and exposes EPC to userspace via
> +a well known device, /dev/sgx/enclave.
> +
> +The net effect is that all enclave VMAs must be MAP_SHARED and are backed by
> +a single file, /dev/sgx/enclave.
> +
> EPC oversubscription
> ====================
>
> --
> 2.22.0
>
Acked-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
/Jarkko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-12 3:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 21:44 [PATCH for_v21] docs: x86/sgx: Add a blurb on basic EPC management to 'kernel internals' Sean Christopherson
2019-07-12 3:47 ` Jarkko Sakkinen
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).