Re: [PATCH 2/4] selftests/sgx: Store base address and size in test enclave

From: Jo Van Bulck
Date: Thu Jul 20 2023 - 15:18:50 EST


On 20.07.23 19:29, Jarkko Sakkinen wrote:

diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c
index d3c7a39f4..bad963c79 100644
--- a/tools/testing/selftests/sgx/main.c
+++ b/tools/testing/selftests/sgx/main.c
@@ -182,6 +1827 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl,
FILE *maps_file;
unsigned int i;
void *addr;
+ uint64_t encl_size_addr;

Should be the first declaration (reverse xmas tree order).

Will do

I'd rename this as encl_end, as the current name is cryptic.

Thank you, agreed the current name is cryptic. However, encl_end is incorrect as this is the location in the enclave that stores the _size_ and the location itself is also _not_ at the end of the enclave.

I'll rename this in the next patch revision to encl_size_pt and make it of type uint64_t*, which seems more logical to me. Let me know if you prefer otherwise!

Best,
Jo