From: Jarkko Sakkinen <jarkko@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: linux-sgx@vger.kernel.org,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arch/x86: Fix size overflows in sgx_encl_create()
Date: Wed, 5 Mar 2025 02:01:52 +0200 [thread overview]
Message-ID: <Z8eUcELiMdcM5IJq@kernel.org> (raw)
In-Reply-To: <45e68dea-af6a-4b2a-8249-420f14de3424@intel.com>
On Tue, Mar 04, 2025 at 03:30:54PM -0800, Dave Hansen wrote:
> On 3/4/25 14:56, Jarkko Sakkinen wrote:
> > The total size calculated for EPC can overflow u64 given the added up page
> > for SECS. Further, the total size calculated for shmem can overflow even
> > when the EPC size stays within limits of u64, given that it adds the extra
> > space for 128 byte PCMD structures (one for each page).
> >
> > Address this by adding the necessary validation for each partial results
> > before going forward. Return -E2BIG when an overflow is detected.
>
> Wouldn't this be a lot simpler if we just had some sane limit that's
> *FAR* below where u64 will overflow?
Yes, we can simply check right at the get go that the uarch requirement
of SGX is satisfied: secs->size is power of two.
BR, Jarkko
prev parent reply other threads:[~2025-03-05 0:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 22:56 [PATCH] arch/x86: Fix size overflows in sgx_encl_create() Jarkko Sakkinen
2025-03-04 23:30 ` Dave Hansen
2025-03-05 0:01 ` 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=Z8eUcELiMdcM5IJq@kernel.org \
--to=jarkko@kernel.org \
--cc=bp@alien8.de \
--cc=dan.carpenter@linaro.org \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.