[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YiLEHBlXAz+sUheO@kernel.org>
Date: Sat, 5 Mar 2022 03:59:56 +0200
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Reinette Chatre <reinette.chatre@...el.com>
Cc: linux-sgx@...r.kernel.org,
Nathaniel McCallum <nathaniel@...fian.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] x86/sgx: Do not limit EAUG'd pages by
pre-initialization policy
On Fri, Mar 04, 2022 at 11:09:36AM -0800, Reinette Chatre wrote:
> Hi Jarkko,
>
> On 3/3/2022 7:39 PM, Jarkko Sakkinen wrote:
> > Pre-initialization policy is meant for EADD'd pages because they are
> > part of the enclave identity. It's a good practice to not let touch the
> > permissions after initialization, and does provide guarantees to e.g.
> > LSM's about the enclave.
>
> I disagree. There are scenarios where it is indeed good practice to
> modify the permissions after initialization. For example, pages that
> may be used for relocatable code can start with RWX permissions but once
> the pages have been populated with the code they should be able to restrict
> permissions to RX only. It is not good practice to require RWX permission
> over their entire lifetime. Ideally pages should only have the lowest
> permissions possible.
The only permissions kernel has real control is PTE permissions when
the enclave has been initialized.
You are introducing an artificial limitation with vm_run_prot_bits
that makes e.g. EMODPE more costly for no good reason, and in-kernel
variable has nothing to do with the permissions. They are located
in EPCM.
> Supporting the modification of permissions after initialization enables
> the security conscious enclave owner to support the security
> principle of least privilege.
1. Kernel has the control of PTE permissions.
2. Enclave has the control of EPCM permissions.
vm_run_prot_bits does not help making anything more secure.
BR, Jarkko
Powered by blists - more mailing lists