diff mbox series

[for_v23,2/7] selftests/x86/sgx: Update test to account for ADD_PAGE change

Message ID 20191009044241.3591-3-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series x86/sgx: Improve add pages ioctl | expand

Commit Message

Sean Christopherson Oct. 9, 2019, 4:42 a.m. UTC
Update the SGX selftest to pass the target offset instead of the full
address when adding pages to an enclave.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 tools/testing/selftests/x86/sgx/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/x86/sgx/main.c b/tools/testing/selftests/x86/sgx/main.c
index f78ff458b0dd..7cffc16c02e0 100644
--- a/tools/testing/selftests/x86/sgx/main.c
+++ b/tools/testing/selftests/x86/sgx/main.c
@@ -164,7 +164,7 @@  static bool encl_create(int dev_fd, unsigned long bin_size,
 	return true;
 }
 
-static bool encl_add_page(int dev_fd, unsigned long addr, void *data,
+static bool encl_add_page(int dev_fd, unsigned long offset, void *data,
 			  uint64_t flags)
 {
 	struct sgx_enclave_add_page ioc;
@@ -176,7 +176,7 @@  static bool encl_add_page(int dev_fd, unsigned long addr, void *data,
 
 	ioc.secinfo = (unsigned long)&secinfo;
 	ioc.mrmask = 0xFFFF;
-	ioc.addr = addr;
+	ioc.offset = offset;
 	ioc.src = (uint64_t)data;
 	memset(ioc.reserved, 0, sizeof(ioc.reserved));
 
@@ -215,8 +215,7 @@  static bool encl_build(struct sgx_secs *secs, void *bin,
 			flags = SGX_SECINFO_REG | SGX_SECINFO_R |
 				SGX_SECINFO_W | SGX_SECINFO_X;
 
-		if (!encl_add_page(dev_fd, secs->base + offset,
-				   bin + offset, flags))
+		if (!encl_add_page(dev_fd, offset, bin + offset, flags))
 			goto out_map;
 	}