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@xxxxxxxxx> --- tools/testing/selftests/x86/sgx/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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; } -- 2.22.0