On Tue, 15 Nov 2022 17:24:29 -0600, Jarkko Sakkinen <jarkko@xxxxxxxxxx>
wrote:
On Mon, Nov 07, 2022 at 02:02:11PM -0800, Haitao Huang wrote:
So we can EACCEPT multiple pages inside enclave without EEXIT,
preparing for testing with MADV_WILLNEED for ranges bigger than
a single page.
Signed-off-by: Haitao Huang <haitao.huang@xxxxxxxxxxxxxxx>
---
tools/testing/selftests/sgx/defines.h | 1 +
tools/testing/selftests/sgx/test_encl.c | 20 ++++++++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/sgx/defines.h
b/tools/testing/selftests/sgx/defines.h
index d8587c971941..8578e773d3d8 100644
--- a/tools/testing/selftests/sgx/defines.h
+++ b/tools/testing/selftests/sgx/defines.h
@@ -60,6 +60,7 @@ struct encl_op_eaccept {
struct encl_op_header header;
uint64_t epc_addr;
uint64_t flags;
+ uint64_t len;
uint64_t ret;
};
diff --git a/tools/testing/selftests/sgx/test_encl.c
b/tools/testing/selftests/sgx/test_encl.c
index c0d6397295e3..fc797385200b 100644
--- a/tools/testing/selftests/sgx/test_encl.c
+++ b/tools/testing/selftests/sgx/test_encl.c
@@ -35,14 +35,22 @@ static void do_encl_eaccept(void *_op)
struct sgx_secinfo secinfo __aligned(sizeof(struct sgx_secinfo)) =
{0};
struct encl_op_eaccept *op = _op;
int rax;
Should be empty line after declarations.
+ if (op->len == 0)
+ op->len = 4096;
What is this?
Existing test cases is always eaccepting one page at a time.
With the new len field, this is to set value to 1 page by default so no
changes in other places is needed.
I can add a comment in struct encl_op_eaccept declaration or let me know
if you prefer a different way.
Thanks
Haitao
Haitao