From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: linux-sgx@vger.kernel.org, Shay Katz-zamir <shay.katz-zamir@intel.com>
Subject: Re: [PATCH RFC] x86/sgx: Check that the address is within ELRANGE
Date: Wed, 19 Jun 2019 15:24:29 +0300 [thread overview]
Message-ID: <c0b82ee1fef7635181e8f513d489524f41e57358.camel@linux.intel.com> (raw)
In-Reply-To: <20190617223029.GB30158@linux.intel.com>
On Mon, 2019-06-17 at 15:30 -0700, Sean Christopherson wrote:
> On Thu, Jun 13, 2019 at 07:42:40PM +0300, Jarkko Sakkinen wrote:
> > In sgx_encl_page_alloc() check that the given address within the
> > ELRANGE. Return -EINVAL if not.
> >
> > Reported-by: Shay Katz-zamir <shay.katz-zamir@intel.com>
> > Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > ---
> > arch/x86/kernel/cpu/sgx/driver/ioctl.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/arch/x86/kernel/cpu/sgx/driver/ioctl.c
> > b/arch/x86/kernel/cpu/sgx/driver/ioctl.c
> > index d17c60dca114..9d3fc770b4d9 100644
> > --- a/arch/x86/kernel/cpu/sgx/driver/ioctl.c
> > +++ b/arch/x86/kernel/cpu/sgx/driver/ioctl.c
> > @@ -240,19 +240,26 @@ static struct sgx_encl_page
> > *sgx_encl_page_alloc(struct sgx_encl *encl,
> > struct sgx_encl_page *encl_page;
> > int ret;
> >
> > + if (addr < encl->base || addr > (encl->base + encl->size))
>
> The upper bounds check should be "addr >= (encl->base + encl->size)" or
> "addr > (encl->base + encl->size - 1)"
Right, thanks :-) Shay told me that this did not happen with earlier
patch set versions but I could not spot why. Have to look again
before merging.
/Jarkko
prev parent reply other threads:[~2019-06-19 12:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 16:42 [PATCH RFC] x86/sgx: Check that the address is within ELRANGE Jarkko Sakkinen
2019-06-17 22:30 ` Sean Christopherson
2019-06-19 12:24 ` Jarkko Sakkinen [this message]
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=c0b82ee1fef7635181e8f513d489524f41e57358.camel@linux.intel.com \
--to=jarkko.sakkinen@linux.intel.com \
--cc=linux-sgx@vger.kernel.org \
--cc=sean.j.christopherson@intel.com \
--cc=shay.katz-zamir@intel.com \
/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