linux-sgx.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
	jarkko@kernel.org, dave.hansen@linux.intel.com,
	linux-sgx@vger.kernel.org, shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 2/4] selftests/sgx: Do not attempt enclave build without valid enclave
Date: Fri, 28 Jan 2022 11:03:50 -0800	[thread overview]
Message-ID: <920a4095-f405-fb39-78d5-cd0ec2ae6484@intel.com> (raw)
In-Reply-To: <f2b46fd652450d9361577e63a8d4b0b85190c4a2.1643393473.git.reinette.chatre@intel.com>

On 1/28/22 10:23, Reinette Chatre wrote:
> It is not possible to build an enclave if it was not possible to load
> the binary from which it should be constructed. Do not attempt
> to make further progress but instead return with failure.
> 
> Fixes: 1b35eb719549 ("selftests/sgx: Encpsulate the test enclave creation")
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>

Acked-by: Dave Hansen <dave.hansen@linux.intel.com>

>  tools/testing/selftests/sgx/main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c
> index 370c4995f7c4..a7cd2c3e6f7e 100644
> --- a/tools/testing/selftests/sgx/main.c
> +++ b/tools/testing/selftests/sgx/main.c
> @@ -147,6 +147,7 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl,
>  	if (!encl_load("test_encl.elf", encl, heap_size)) {
>  		encl_delete(encl);
>  		TH_LOG("Failed to load the test enclave.\n");
> +		return false;
>  	}
>  
>  	if (!encl_measure(encl))

One more sentence to add to the changelog:

	A "return false" from setup_test_encl() is expected to trip an
	ASSERT_TRUE() and abort the rest of the test.

That at least saves a reviewer from needing to check what the callers see.

  reply	other threads:[~2022-01-28 19:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 18:23 [PATCH 0/4] selftests/sgx: Early enclave loading error path fixes Reinette Chatre
2022-01-28 18:23 ` [PATCH 1/4] selftests/sgx: Fix segfault upon early test failure Reinette Chatre
2022-01-28 18:43   ` Dave Hansen
2022-01-28 19:22     ` Reinette Chatre
2022-01-28 19:26       ` Dave Hansen
2022-01-28 20:08         ` Reinette Chatre
2022-02-15 19:39   ` Jarkko Sakkinen
2022-01-28 18:23 ` [PATCH 2/4] selftests/sgx: Do not attempt enclave build without valid enclave Reinette Chatre
2022-01-28 19:03   ` Dave Hansen [this message]
2022-01-28 19:23     ` Reinette Chatre
2022-02-15 19:35   ` Jarkko Sakkinen
2022-01-28 18:23 ` [PATCH 3/4] selftests/sgx: Ensure enclave data available during debug print Reinette Chatre
2022-01-28 19:06   ` Dave Hansen
2022-01-28 19:40     ` Reinette Chatre
2022-02-15 19:35   ` Jarkko Sakkinen
2022-01-28 18:23 ` [PATCH 4/4] selftests/sgx: Remove extra newlines in test output Reinette Chatre
2022-01-28 19:07   ` Dave Hansen
2022-02-15 19:34   ` 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=920a4095-f405-fb39-78d5-cd0ec2ae6484@intel.com \
    --to=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jarkko@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@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).