lkml.org 
[lkml]   [2019]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v20 00/28] Intel SGX1 support
On Thu, May 16, 2019 at 09:51:03AM +0300, Jarkko Sakkinen wrote:
> On Thu, May 16, 2019 at 08:07:05AM +0300, Jarkko Sakkinen wrote:
> > On Wed, May 15, 2019 at 07:27:02AM -0700, Andy Lutomirski wrote:
> > >
> > > > On May 15, 2019, at 4:00 AM, Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:
> > > >
> > > >> On Wed, May 15, 2019 at 01:35:31PM +0300, Jarkko Sakkinen wrote:
> > > >> This brings me to an open question in Andy's model: lets say that we
> > > >> change the source for SIGSTRUCT from memory address to fd. How can the
> > > >> policy prevent the use not creating a file containing a SIGSTRUCT and
> > > >> passing fd of that to the EINIT ioctl?
> > > >
> > >
> > > The policy will presumably check the label on the file that the fd points to.
> >
> > Right (checked SELinux documentation).
> >
> > Got one idea from this. Right now creation and initialization does not
> > require any VMAs to be created (since v20). Requiring to map a VMA for
> > copying the data would bring in my opinion a glitch to this model that
> > we have done effort to build up.
> >
> > What if we similarly change EADD ioctl in a way that it'd take an fd
> > and an offset? This way we can enforce policy to the source where the
> > enclave data is loaded from. On the other hand, loading SIGSTRUCT from
> > fd enforces a legit structure for the enclave.
> >
> > This would still allow to construct enclaves in VMA independent way.
>
> The API would turn into this:
>
> /**
> * struct sgx_enclave_add_page - parameter structure for the
> * %SGX_IOC_ENCLAVE_ADD_PAGE ioctl
> * @fd: file containing the page data
> * @offset: offset in the file containing the page data
> * @secinfo: address for the SECINFO data
> * @mrmask: bitmask for the measured 256 byte chunks
> */
> struct sgx_enclave_add_page {
> __u64 fd;
> __u64 offset;
> __u64 secinfo;
> __u16 mrmask;
> } __attribute__((__packed__));
>
>
> /**
> * struct sgx_enclave_init - parameter structure for the
> * %SGX_IOC_ENCLAVE_INIT ioctl
> * @fd: file containing the sigstruct
> * @offset: offset in the file containing the sigstruct
> */
> struct sgx_enclave_init {
> __u64 fd;
> __u64 offset;
> };

The change to EADD/EINIT ioctl's would be simply fget/kernel_read/fput
sequence replacing copy_from_user().

/Jarkko

\
 
 \ /
  Last update: 2019-05-16 09:03    [W:0.116 / U:36.820 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site