summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/sgx/main.c
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2021-11-15 21:35:23 +0300
committerDave Hansen <dave.hansen@linux.intel.com>2021-11-15 22:34:11 +0300
commitc085dfc7685c8c36698b851b03990b75a3226e97 (patch)
treea06856aab1adf958a7d0500b19a63e67bf91279d /tools/testing/selftests/sgx/main.c
parent41493a095e487c207b4b702aee2f8c59a7294e4f (diff)
downloadlinux-c085dfc7685c8c36698b851b03990b75a3226e97.tar.xz
selftests/sgx: Rename test properties in preparation for more enclave tests
SGX selftests prepares a data structure outside of the enclave with the type of and data for the operation that needs to be run within the enclave. At this time only two complementary operations are supported by the enclave: copying a value from outside the enclave into a default buffer within the enclave and reading a value from the enclave's default buffer into a variable accessible outside the enclave. In preparation for more operations supported by the enclave the names of the current enclave operations are changed to more accurately reflect the operations and more easily distinguish it from future operations: * The enums ENCL_OP_PUT and ENCL_OP_GET are renamed to ENCL_OP_PUT_TO_BUFFER and ENCL_OP_GET_FROM_BUFFER respectively. * The structs encl_op_put and encl_op_get are renamed to encl_op_put_to_buf and encl_op_get_from_buf respectively. * The enclave functions do_encl_op_put and do_encl_op_get are renamed to do_encl_op_put_to_buf and do_encl_op_get_from_buf respectively. No functional changes. Suggested-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Jarkko Sakkinen <jarkko@kernel.org> Acked-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://lkml.kernel.org/r/023fda047c787cf330b88ed9337705edae6a0078.1636997631.git.reinette.chatre@intel.com
Diffstat (limited to 'tools/testing/selftests/sgx/main.c')
-rw-r--r--tools/testing/selftests/sgx/main.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c
index 3996c00486b6..61321229e485 100644
--- a/tools/testing/selftests/sgx/main.c
+++ b/tools/testing/selftests/sgx/main.c
@@ -220,15 +220,15 @@ FIXTURE_TEARDOWN(enclave)
TEST_F(enclave, unclobbered_vdso)
{
- struct encl_op_put put_op;
- struct encl_op_get get_op;
+ struct encl_op_get_from_buf get_op;
+ struct encl_op_put_to_buf put_op;
ASSERT_TRUE(setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata));
memset(&self->run, 0, sizeof(self->run));
self->run.tcs = self->encl.encl_base;
- put_op.header.type = ENCL_OP_PUT;
+ put_op.header.type = ENCL_OP_PUT_TO_BUFFER;
put_op.value = MAGIC;
EXPECT_EQ(ENCL_CALL(&put_op, &self->run, false), 0);
@@ -236,7 +236,7 @@ TEST_F(enclave, unclobbered_vdso)
EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
- get_op.header.type = ENCL_OP_GET;
+ get_op.header.type = ENCL_OP_GET_FROM_BUFFER;
get_op.value = 0;
EXPECT_EQ(ENCL_CALL(&get_op, &self->run, false), 0);
@@ -292,9 +292,9 @@ static unsigned long get_total_epc_mem(void)
TEST_F(enclave, unclobbered_vdso_oversubscribed)
{
+ struct encl_op_get_from_buf get_op;
+ struct encl_op_put_to_buf put_op;
unsigned long total_mem;
- struct encl_op_put put_op;
- struct encl_op_get get_op;
total_mem = get_total_epc_mem();
ASSERT_NE(total_mem, 0);
@@ -303,7 +303,7 @@ TEST_F(enclave, unclobbered_vdso_oversubscribed)
memset(&self->run, 0, sizeof(self->run));
self->run.tcs = self->encl.encl_base;
- put_op.header.type = ENCL_OP_PUT;
+ put_op.header.type = ENCL_OP_PUT_TO_BUFFER;
put_op.value = MAGIC;
EXPECT_EQ(ENCL_CALL(&put_op, &self->run, false), 0);
@@ -311,7 +311,7 @@ TEST_F(enclave, unclobbered_vdso_oversubscribed)
EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
- get_op.header.type = ENCL_OP_GET;
+ get_op.header.type = ENCL_OP_GET_FROM_BUFFER;
get_op.value = 0;
EXPECT_EQ(ENCL_CALL(&get_op, &self->run, false), 0);
@@ -324,15 +324,15 @@ TEST_F(enclave, unclobbered_vdso_oversubscribed)
TEST_F(enclave, clobbered_vdso)
{
- struct encl_op_put put_op;
- struct encl_op_get get_op;
+ struct encl_op_get_from_buf get_op;
+ struct encl_op_put_to_buf put_op;
ASSERT_TRUE(setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata));
memset(&self->run, 0, sizeof(self->run));
self->run.tcs = self->encl.encl_base;
- put_op.header.type = ENCL_OP_PUT;
+ put_op.header.type = ENCL_OP_PUT_TO_BUFFER;
put_op.value = MAGIC;
EXPECT_EQ(ENCL_CALL(&put_op, &self->run, true), 0);
@@ -340,7 +340,7 @@ TEST_F(enclave, clobbered_vdso)
EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
- get_op.header.type = ENCL_OP_GET;
+ get_op.header.type = ENCL_OP_GET_FROM_BUFFER;
get_op.value = 0;
EXPECT_EQ(ENCL_CALL(&get_op, &self->run, true), 0);
@@ -360,8 +360,8 @@ static int test_handler(long rdi, long rsi, long rdx, long ursp, long r8, long r
TEST_F(enclave, clobbered_vdso_and_user_function)
{
- struct encl_op_put put_op;
- struct encl_op_get get_op;
+ struct encl_op_get_from_buf get_op;
+ struct encl_op_put_to_buf put_op;
ASSERT_TRUE(setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata));
@@ -371,7 +371,7 @@ TEST_F(enclave, clobbered_vdso_and_user_function)
self->run.user_handler = (__u64)test_handler;
self->run.user_data = 0xdeadbeef;
- put_op.header.type = ENCL_OP_PUT;
+ put_op.header.type = ENCL_OP_PUT_TO_BUFFER;
put_op.value = MAGIC;
EXPECT_EQ(ENCL_CALL(&put_op, &self->run, true), 0);
@@ -379,7 +379,7 @@ TEST_F(enclave, clobbered_vdso_and_user_function)
EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
- get_op.header.type = ENCL_OP_GET;
+ get_op.header.type = ENCL_OP_GET_FROM_BUFFER;
get_op.value = 0;
EXPECT_EQ(ENCL_CALL(&get_op, &self->run, true), 0);