Re: [RFC PATCH 7/9] x86/sgx: Enforce noexec filesystem restriction for enclaves
From: Sean Christopherson <hidden>
Date: 2019-06-04 20:34:47
Also in:
lkml, selinux
From: Sean Christopherson <hidden>
Date: 2019-06-04 20:34:47
Also in:
lkml, selinux
On Tue, Jun 04, 2019 at 01:25:10PM -0700, Andy Lutomirski wrote:
On Tue, Jun 4, 2019 at 9:26 AM Jarkko Sakkinen [off-list ref] wrote:quoted
On Fri, May 31, 2019 at 04:31:57PM -0700, Sean Christopherson wrote:quoted
Do not allow an enclave page to be mapped with PROT_EXEC if the source page is backed by a file on a noexec file system. Signed-off-by: Sean Christopherson <redacted>Why don't you just check in sgx_encl_add_page() that whether the path comes from noexec and deny if SECINFO contains X?SECINFO seems almost entirely useless for this kind of thing because of SGX2. I'm thinking that SECINFO should be completely ignored for anything other than its required architectural purpose.
Agreed. I've already (somewhat unknowingly) reworked the SELinux patch such that it ignores @prot (the SECINFO protections) and only looks at @allowed_prot (the declared protections). If the kernel ignores SECINFO protections entirely then the LSM hook can simply be: int selinux_enclave_load(struct vm_area_struct *vma, unsigned long prot) I.e. LSMs can be blissfully unaware that @prot isn't technically what's going into the PTEs *now*.