Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-18 Thread Dr. Greg
On Mon, Jun 17, 2019 at 09:49:15AM -0700, Sean Christopherson wrote: Good morning to everyone. > On Sun, Jun 16, 2019 at 03:14:51PM -0700, Andy Lutomirski wrote: > > The most significant issue I see is the following. Consider two > > cases. First, an SGX2 enclave that dynamically allocates memor

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-17 Thread Andy Lutomirski
On Mon, Jun 17, 2019 at 9:49 AM Sean Christopherson wrote: > > On Sun, Jun 16, 2019 at 03:14:51PM -0700, Andy Lutomirski wrote: > > On Fri, Jun 14, 2019 at 8:38 AM Sean Christopherson > > wrote: > > > > Andy and/or Cedric, can you please weigh in with a concrete (and > > > > practical) > > > > u

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-17 Thread Sean Christopherson
On Sun, Jun 16, 2019 at 03:14:51PM -0700, Andy Lutomirski wrote: > On Fri, Jun 14, 2019 at 8:38 AM Sean Christopherson > wrote: > > > Andy and/or Cedric, can you please weigh in with a concrete (and > > > practical) > > > use case that will break if we go with #1? The auditing issues for #2/#3 >

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-16 Thread Andy Lutomirski
On Fri, Jun 14, 2019 at 10:16 AM Xing, Cedric wrote: > > > From: Christopherson, Sean J > > Sent: Thursday, June 13, 2019 5:46 PM > > > > On Thu, Jun 13, 2019 at 01:02:17PM -0400, Stephen Smalley wrote: > > > On 6/11/19 6:02 PM, Sean Christopherson wrote: > > > >On Tue, Jun 11, 2019 at 09:40:25AM

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-16 Thread Andy Lutomirski
On Fri, Jun 14, 2019 at 8:38 AM Sean Christopherson wrote: > > On Thu, Jun 13, 2019 at 05:46:00PM -0700, Sean Christopherson wrote: > > On Thu, Jun 13, 2019 at 01:02:17PM -0400, Stephen Smalley wrote: > > > On 6/11/19 6:02 PM, Sean Christopherson wrote: > > > >On Tue, Jun 11, 2019 at 09:40:25AM -0

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-14 Thread Dr. Greg
On Thu, Jun 13, 2019 at 05:46:00PM -0700, Sean Christopherson wrote: Good afternoon, I hope the week is ending well for everyone. > On Thu, Jun 13, 2019 at 01:02:17PM -0400, Stephen Smalley wrote: > > Given the complexity tradeoff, what is the clear motivating > > example for why #1 isn't the obv

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-14 Thread Sean Christopherson
On Fri, Jun 14, 2019 at 10:53:39AM -0700, Sean Christopherson wrote: > On Fri, Jun 14, 2019 at 10:45:56AM -0700, Sean Christopherson wrote: > > The state tracking of #2/#3 doesn't scare me, it's purely the auditing. > > Holding an audit message for an indeterminate amount of time is a > > nightmare

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-14 Thread Sean Christopherson
On Fri, Jun 14, 2019 at 10:45:56AM -0700, Sean Christopherson wrote: > The state tracking of #2/#3 doesn't scare me, it's purely the auditing. > Holding an audit message for an indeterminate amount of time is a > nightmare. > > Here's a thought. What if we simply require FILE__EXECUTE or AA_EXEC_

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-14 Thread Sean Christopherson
On Fri, Jun 14, 2019 at 10:16:55AM -0700, Xing, Cedric wrote: > > From: Christopherson, Sean J > > Sent: Thursday, June 13, 2019 5:46 PM > > > > On Thu, Jun 13, 2019 at 01:02:17PM -0400, Stephen Smalley wrote: > > > On 6/11/19 6:02 PM, Sean Christopherson wrote: > > > >My RFC series[1] implements

RE: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-14 Thread Xing, Cedric
> From: Christopherson, Sean J > Sent: Thursday, June 13, 2019 5:46 PM > > On Thu, Jun 13, 2019 at 01:02:17PM -0400, Stephen Smalley wrote: > > On 6/11/19 6:02 PM, Sean Christopherson wrote: > > >On Tue, Jun 11, 2019 at 09:40:25AM -0400, Stephen Smalley wrote: > > >>I haven't looked at this code c

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-14 Thread Sean Christopherson
On Thu, Jun 13, 2019 at 05:46:00PM -0700, Sean Christopherson wrote: > On Thu, Jun 13, 2019 at 01:02:17PM -0400, Stephen Smalley wrote: > > On 6/11/19 6:02 PM, Sean Christopherson wrote: > > >On Tue, Jun 11, 2019 at 09:40:25AM -0400, Stephen Smalley wrote: > > >>I haven't looked at this code closel

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Sean Christopherson
On Thu, Jun 13, 2019 at 01:02:17PM -0400, Stephen Smalley wrote: > On 6/11/19 6:02 PM, Sean Christopherson wrote: > >On Tue, Jun 11, 2019 at 09:40:25AM -0400, Stephen Smalley wrote: > >>I haven't looked at this code closely, but it feels like a lot of > >>SGX-specific logic embedded into SELinux th

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Sean Christopherson
On Thu, Jun 13, 2019 at 02:00:29PM -0400, Stephen Smalley wrote: > On 6/11/19 6:55 PM, Xing, Cedric wrote: > >*_noaudit() is exactly what I wanted. But I couldn't find > >selinux_file_mprotect_noaudit()/file_has_perm_noaudit(), and I'm reluctant > >to duplicate code. Any suggestions? > > I would h

RE: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Xing, Cedric
> From: Christopherson, Sean J > Sent: Thursday, June 13, 2019 4:18 PM > > On Thu, Jun 13, 2019 at 04:03:24PM -0700, Xing, Cedric wrote: > > > From: Stephen Smalley [mailto:s...@tycho.nsa.gov] > > > Sent: Thursday, June 13, 2019 10:02 AM > > > > > > > My RFC series[1] implements #1. My understand

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Sean Christopherson
On Thu, Jun 13, 2019 at 04:03:24PM -0700, Xing, Cedric wrote: > > From: Stephen Smalley [mailto:s...@tycho.nsa.gov] > > Sent: Thursday, June 13, 2019 10:02 AM > > > > > My RFC series[1] implements #1. My understanding is that Andy > > > (Lutomirski) prefers #2. Cedric's RFC series implements #3.

RE: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Xing, Cedric
> From: Stephen Smalley [mailto:s...@tycho.nsa.gov] > Sent: Thursday, June 13, 2019 10:02 AM > > On 6/11/19 6:02 PM, Sean Christopherson wrote: > > On Tue, Jun 11, 2019 at 09:40:25AM -0400, Stephen Smalley wrote: > >> I haven't looked at this code closely, but it feels like a lot of > >> SGX-speci

RE: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Xing, Cedric
> From: Christopherson, Sean J > Sent: Thursday, June 13, 2019 12:49 PM > > > >By "SGX", did you mean the SGX subsystem being upstreamed? It doesn’t > > >track that state. In practice, there's no way for SGX to track it > > >because there's no vm_ops->may_mprotect() callback. It doesn't follow > >

RE: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Xing, Cedric
> From: linux-sgx-ow...@vger.kernel.org [mailto:linux-sgx- > ow...@vger.kernel.org] On Behalf Of Stephen Smalley > > On 6/11/19 6:55 PM, Xing, Cedric wrote: > >> From: linux-sgx-ow...@vger.kernel.org [mailto:linux-sgx- > >> ow...@vger.kernel.org] On Behalf Of Stephen Smalley > >> Sent: Tuesday, Ju

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Sean Christopherson
On Thu, Jun 13, 2019 at 02:00:29PM -0400, Stephen Smalley wrote: > On 6/11/19 6:55 PM, Xing, Cedric wrote: > >You are right that there are SGX specific stuff. More precisely, SGX > >enclaves don't have access to anything except memory, so there are only 3 > >questions that need to be answered for e

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Stephen Smalley
On 6/11/19 6:55 PM, Xing, Cedric wrote: From: linux-sgx-ow...@vger.kernel.org [mailto:linux-sgx- ow...@vger.kernel.org] On Behalf Of Stephen Smalley Sent: Tuesday, June 11, 2019 6:40 AM +#ifdef CONFIG_INTEL_SGX + rc = sgxsec_mprotect(vma, prot); + if (rc <= 0) + retur

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Sean Christopherson
On Wed, Jun 12, 2019 at 12:30:20PM -0700, Andy Lutomirski wrote: > On Tue, Jun 11, 2019 at 3:02 PM Sean Christopherson > wrote: > > > > 1. Require userspace to explicitly specificy (maximal) enclave page > > permissions at build time. The enclave page permissions are provided > > to,

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Stephen Smalley
On 6/11/19 6:02 PM, Sean Christopherson wrote: On Tue, Jun 11, 2019 at 09:40:25AM -0400, Stephen Smalley wrote: I haven't looked at this code closely, but it feels like a lot of SGX-specific logic embedded into SELinux that will have to be repeated or reused for every security module. Does SGX

RE: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Xing, Cedric
> From: Christopherson, Sean J > Sent: Wednesday, June 12, 2019 3:03 PM > > > I think this model works quite well in an SGX1 world. The main thing > > that makes me uneasy about this model is that, in SGX2, it requires > > that an SGX2-compatible enclave loader must pre-declare to the kernel > >

RE: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Xing, Cedric
> From: Christopherson, Sean J > Sent: Wednesday, June 12, 2019 3:03 PM > > > I think this model works quite well in an SGX1 world. The main thing > > that makes me uneasy about this model is that, in SGX2, it requires > > that an SGX2-compatible enclave loader must pre-declare to the kernel > >

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-13 Thread Dr. Greg
On Wed, Jun 12, 2019 at 07:25:57AM -0700, Sean Christopherson wrote: Good morning, we hope the week continues to go well for everyone. > On Wed, Jun 12, 2019 at 04:32:21AM -0500, Dr. Greg wrote: > > With SGX2 we will, by necessity, have to admit the notion that a > > platform owner will not have

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-12 Thread Andy Lutomirski
On Tue, Jun 11, 2019 at 3:02 PM Sean Christopherson wrote: > > On Tue, Jun 11, 2019 at 09:40:25AM -0400, Stephen Smalley wrote: > > I haven't looked at this code closely, but it feels like a lot of > > SGX-specific logic embedded into SELinux that will have to be repeated or > > reused for every s

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-12 Thread Sean Christopherson
On Wed, Jun 12, 2019 at 04:32:21AM -0500, Dr. Greg wrote: > With SGX2 we will, by necessity, have to admit the notion that a > platform owner will not have any effective visibility into code that > is loaded and executed, since it can come in over a secured network > connection in an enclave securi

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-12 Thread Dr. Greg
On Tue, Jun 11, 2019 at 03:02:43PM -0700, Sean Christopherson wrote: Good morning, I hope the week is proceeding well for everyone. > On Tue, Jun 11, 2019 at 09:40:25AM -0400, Stephen Smalley wrote: > > I haven't looked at this code closely, but it feels like a lot of > > SGX-specific logic embed

RE: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-11 Thread Xing, Cedric
> From: linux-sgx-ow...@vger.kernel.org [mailto:linux-sgx- > ow...@vger.kernel.org] On Behalf Of Stephen Smalley > Sent: Tuesday, June 11, 2019 6:40 AM > > > > > +#ifdef CONFIG_INTEL_SGX > > + rc = sgxsec_mprotect(vma, prot); > > + if (rc <= 0) > > + return rc; > > Why are you skipp

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-11 Thread Sean Christopherson
On Tue, Jun 11, 2019 at 09:40:25AM -0400, Stephen Smalley wrote: > I haven't looked at this code closely, but it feels like a lot of > SGX-specific logic embedded into SELinux that will have to be repeated or > reused for every security module. Does SGX not track this state itself? SGX does track

Re: [RFC PATCH v1 2/3] LSM/x86/sgx: Implement SGX specific hooks in SELinux

2019-06-11 Thread Stephen Smalley
On 6/10/19 3:03 AM, Cedric Xing wrote: In this patch, SELinux maintains two bits per enclave page, namely SGX__EXECUTE and SGX__EXECMOD. SGX__EXECUTE is set initially (by selinux_enclave_load) for every enclave page that was loaded from a potentially executable source page. SGX__EXECMOD is set f