Intel SGX development
 help / color / mirror / Atom feed
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Jo Van Bulck" <jo.vanbulck@cs.kuleuven.be>,
	<linux-sgx@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <dave.hansen@linux.intel.com>
Subject: Re: [PATCH 0/4] selftests/sgx: Harden test enclave
Date: Sat, 22 Jul 2023 18:10:42 +0000	[thread overview]
Message-ID: <CU8WIZGB01DT.2YX12UG6QRTA@seitikki> (raw)
In-Reply-To: <a6e26927-acb0-c967-10c4-90a41d9a8cad@cs.kuleuven.be>

On Thu Jul 20, 2023 at 7:12 PM UTC, Jo Van Bulck wrote:
> On 20.07.23 19:25, Jarkko Sakkinen wrote:
> > There's a lot of source code in kselftest, which probably has at least
> > some security issues.
> > 
> > I'm not sure, at least based on this motivation, why would we care?
>
> I'd argue that, in general, code examples are often used as templates 
> and may thus inherit any vulnerabilities therein. This may be especially 
> relevant here as your selftest enclave is in my knowledge the only 
> available truly minimal SGX enclave that can be built and extended while 
> only relying on standard tools and no heavy frameworks like the Intel 
> SGX SDK. Thus, as noted before on this mailing list, it may be an 
> attractive start for people who want to build things from scratch.

If you use this code as a template,  you have a legal risk in your hands
because of GPLv2 licensing.

> IMHO the example enclave should do a best effort to reasonably follow 
> SGX coding best practices and not have _known_ security vulnerabilities 
> in it. Note that these are not advanced microarchitectural attacks with 
> ugly LFENCE defenses, but plain, architectural memory-safety exploit 
> preventions with minimal sanitization checks, not unlike the existing 
> protections against buffer overflow where best practices are followed 
> for op->type.

I'm not sure what are the "best practices" behavior in the context of a
kselftest instance.

> Apart from that, the added checks only enforce correct behavior in the 
> test framework, only validating that things are sane and as expected. 
> Thus, to some extent, the added checks may even increase resilience of 
> the test framework.

I'm not sure what is "correct" behavior in the context of a kselftest
instance.

> Best,
> Jo

This code is not meant for production. I implemented it specifically for
kselftest, and that is exactly its scope.

BR, Jarkko

  parent reply	other threads:[~2023-07-22 18:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 14:24 [PATCH 0/4] selftests/sgx: Harden test enclave Jo Van Bulck
2023-07-19 14:24 ` [PATCH 1/4] selftests/sgx: Harden test enclave ABI Jo Van Bulck
2023-07-20 17:27   ` Jarkko Sakkinen
2023-07-20 19:14     ` Jo Van Bulck
2023-07-19 14:24 ` [PATCH 2/4] selftests/sgx: Store base address and size in test enclave Jo Van Bulck
2023-07-20 17:29   ` Jarkko Sakkinen
2023-07-20 19:18     ` Jo Van Bulck
2023-07-19 14:24 ` [PATCH 3/4] selftests/sgx: Harden test enclave API Jo Van Bulck
2023-07-20 17:32   ` Jarkko Sakkinen
2023-07-20 19:34     ` Jo Van Bulck
2023-07-19 14:25 ` [PATCH 4/4] selftests/sgx: Fix compiler optimizations in test enclave Jo Van Bulck
2023-07-20 17:25 ` [PATCH 0/4] selftests/sgx: Harden " Jarkko Sakkinen
2023-07-20 19:12   ` Jo Van Bulck
2023-07-20 19:56     ` Dave Hansen
2023-07-20 20:57       ` Jo Van Bulck
2023-07-22 18:10     ` Jarkko Sakkinen [this message]
2023-07-24 10:46       ` Jo Van Bulck
2023-07-28 18:54         ` Jarkko Sakkinen
2023-08-07  6:06           ` Jo Van Bulck
2023-08-07 11:58             ` 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=CU8WIZGB01DT.2YX12UG6QRTA@seitikki \
    --to=jarkko@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=jo.vanbulck@cs.kuleuven.be \
    --cc=linux-kernel@vger.kernel.org \
    --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