From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Haitao Huang <haitao.huang@linux.intel.com>,
linux-sgx@vger.kernel.org, Jethro Beekman <jethro@fortanix.com>,
Dave Hansen <dave.hansen@linux.intel.com>
Subject: Re: [PATCH] x86/sgx: Remove checks for platform limits from sgx_validate_secs()
Date: Mon, 5 Oct 2020 15:46:26 -0700 [thread overview]
Message-ID: <20201005224626.GC15803@linux.intel.com> (raw)
In-Reply-To: <20201005113840.GA181338@linux.intel.com>
On Mon, Oct 05, 2020 at 02:38:40PM +0300, Jarkko Sakkinen wrote:
> On Sun, Oct 04, 2020 at 11:00:28PM -0500, Haitao Huang wrote:
> > On Sun, 04 Oct 2020 21:08:19 -0500, Jarkko Sakkinen
> > <jarkko.sakkinen@linux.intel.com> wrote:
> >
> > > Remove from sgx_validate_secs():
> > >
> > > if (secs->miscselect & sgx_misc_reserved_mask ||
> > > secs->attributes & sgx_attributes_reserved_mask ||
> > > secs->xfrm & sgx_xfrm_reserved_mask)
> > > return -EINVAL;
> > >
> > > SECS can surpass the platform limits because it's the SIGSTRUCT that
> > > defines the limits that are used at run-time.
> > >
> > > What SECS does is that it defines the overall limits that must apply for
> > > any platform, i.e. SECS limits and platform limits are orthogonal. They
> > > are not dependent.
> > >
> > > Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> > > Cc: Jethro Beekman <jethro@fortanix.com>
> > > Cc: Dave Hansen <dave.hansen@linux.intel.com>
> > > Suggested-by: Haitao Huang <haitao.huang@linux.intel.com>
> > > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > > ---
> > > arch/x86/kernel/cpu/sgx/ioctl.c | 5 -----
> > > 1 file changed, 5 deletions(-)
> > >
> > > diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c
> > > b/arch/x86/kernel/cpu/sgx/ioctl.c
> > > index 6b3cc8483008..008752cb54f0 100644
> > > --- a/arch/x86/kernel/cpu/sgx/ioctl.c
> > > +++ b/arch/x86/kernel/cpu/sgx/ioctl.c
> > > @@ -86,11 +86,6 @@ static int sgx_validate_secs(const struct sgx_secs
> > > *secs)
> > > if (secs->base & (secs->size - 1))
> > > return -EINVAL;
> > > - if (secs->miscselect & sgx_misc_reserved_mask ||
> > > - secs->attributes & sgx_attributes_reserved_mask ||
> > > - secs->xfrm & sgx_xfrm_reserved_mask)
> > > - return -EINVAL;
> > > -
> > > if (secs->size > max_size)
> > > return -EINVAL;
> > >
> >
> > Looks good to me.
> > Thanks
> > Haitao
>
> Thanks, I'll merge it then.
You can't remove this wholesale, the kernel should still disallow access to
features that are unknown to the kernel and/or are explicitly disallowed by
the kernel. E.g. see SGX_ATTR_RESERVED_MASK and SGX_MISC_RESERVED_MASK.
Dropping sgx_xfrm_reserved_mask is ok because the CPU explicitly checks that
XFRM is a strict subset of the current XCR0, though that makes me wonder what
it does with XSS...
next prev parent reply other threads:[~2020-10-06 0:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-05 2:08 [PATCH] x86/sgx: Remove checks for platform limits from sgx_validate_secs() Jarkko Sakkinen
2020-10-05 2:29 ` Jarkko Sakkinen
2020-10-05 4:00 ` Haitao Huang
2020-10-05 11:38 ` Jarkko Sakkinen
2020-10-05 22:46 ` Sean Christopherson [this message]
2020-10-06 15:16 ` Jarkko Sakkinen
2020-10-06 15:32 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201005224626.GC15803@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=haitao.huang@linux.intel.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=jethro@fortanix.com \
--cc=linux-sgx@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).