[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190118143711.GC4080@linux.intel.com>
Date: Fri, 18 Jan 2019 16:37:11 +0200
From: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Andy Lutomirski <luto@...nel.org>,
"Huang, Kai" <kai.huang@...el.com>,
Jethro Beekman <jethro@...tanix.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"x86@...nel.org" <x86@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
"H. Peter Anvin" <hpa@...or.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-sgx@...r.kernel.org" <linux-sgx@...r.kernel.org>,
Josh Triplett <josh@...htriplett.org>,
Haitao Huang <haitao.huang@...ux.intel.com>,
"Dr . Greg Wettstein" <greg@...ellic.com>
Subject: Re: x86/sgx: uapi change proposal
On Fri, Jan 11, 2019 at 03:19:56PM -0800, Sean Christopherson wrote:
> On Fri, Jan 11, 2019 at 02:58:26PM +0200, Jarkko Sakkinen wrote:
> > On Wed, Jan 09, 2019 at 08:31:37AM -0800, Sean Christopherson wrote:
> > > On Tue, Jan 08, 2019 at 02:54:11PM -0800, Andy Lutomirski wrote:
> > > > On Tue, Jan 8, 2019 at 2:09 PM Sean Christopherson
> > > > <sean.j.christopherson@...el.com> wrote:
> > > > >
> > > > > Cleaner in the sense that it's faster to get basic support up and running
> > > > > since there are fewer touchpoints, but there are long term ramifications
> > > > > to cramming EPC management in KVM.
> > > > >
> > > > > And at this point I'm not stating any absolutes, e.g. how EPC will be
> > > > > handled by KVM. What I'm pushing for is to not eliminate the possibility
> > > > > of having the SGX subsystem own all EPC management, e.g. don't tie
> > > > > /dev/sgx to a single enclave.
> > > >
> > > > I haven't gone and re-read all the relevant SDM bits, so I'll just
> > > > ask: what, if anything, are the actual semantics of mapping "raw EPC"
> > > > like this? You can't actually do anything with the mapping from user
> > > > mode unless you actually get an enclave created and initialized in it
> > > > and have it mapped at the correct linear address, right? I still
> > > > think you have the right idea, but it is a bit unusual.
> > >
> > > Correct, the EPC is inaccessible until a range is "mapped" with ECREATE.
> > > But I'd argue that it's not unusual, just different. And really it's not
> > > all that different than userspace mmap'ing /dev/sgx/enclave prior to
> > > ioctl(ENCLAVE_CREATE). In that case, userspace can still (attempt to)
> > > access the "raw" EPC, i.e. generate a #PF, the kernel/driver just happens
> > > to consider any faulting EPC address without an associated enclave as
> > > illegal, e.g. signals SIGBUS.
> > >
> > > The /dev/sgx/epc case simply has different semantics for moving pages in
> > > and out of the EPC, i.e. different fault and eviction semantics. Yes,
> > > this allows the guest kernel to directly access the "raw" EPC, but that's
> > > conceptually in line with hardware where priveleged software can directly
> > > "access" the EPC (or rather, the abort page for all intents and purposes).
> > > I.e. it's an argument for requiring certain privileges to open /dev/sgx/epc,
> > > but IMO it's not unusual.
> > >
> > > Maybe /dev/sgx/epc is a poor name and is causing confusion, e.g.
> > > /dev/sgx/virtualmachine might be more appropriate.
> >
> > What do you mean by saying "requiring certain privileges"? Are you
> > saying that "raw EPC" (lets say /dev/vmsgx, which probably the name I
> > will use for the device *if* it is required) device would require
> > differet privileged than /dev/sgx?
>
> I don't think it would be mandatory, especially if PROVISION and EINITTOKEN
> attributes are routed through securityfs, but it might be nice to have
> since the functionality provided by /dev/vmsgx would be different than
> /dev/sgx.
>
> Side topic, what's the reasoning for doing /dev/sgx and /dev/vmsgx instead
> of /dev/sgx/{enclave,vm,etc...}?
I don't see we having more than two devices.
Directory hierarchies would make sense if there was variable numer of
stuff initialized.
/Jarkko
Powered by blists - more mailing lists