@@ -165,20 +165,22 @@ static bool encl_create(int dev_fd, unsigned long bin_size,
}
static bool encl_add_pages(int dev_fd, unsigned long offset, void *data,
- unsigned long nr_pages, uint64_t flags)
+ unsigned long nr_pages, uint64_t sec_flags,
+ uint32_t misc_flags)
{
struct sgx_enclave_add_pages ioc;
struct sgx_secinfo secinfo;
int rc;
memset(&secinfo, 0, sizeof(secinfo));
- secinfo.flags = flags;
+ secinfo.flags = sec_flags;
ioc.secinfo = (unsigned long)&secinfo;
ioc.mrmask = 0xFFFF;
ioc.offset = offset;
ioc.src = (uint64_t)data;
ioc.nr_pages = nr_pages;
+ ioc.flags = misc_flags;
memset(ioc.reserved, 0, sizeof(ioc.reserved));
rc = ioctl(dev_fd, SGX_IOC_ENCLAVE_ADD_PAGES, &ioc);
@@ -210,9 +212,9 @@ static bool encl_build(struct sgx_secs *secs, void *bin,
if (!encl_create(dev_fd, bin_size, secs))
goto out_dev_fd;
- encl_add_pages(dev_fd, 0, bin, 1, SGX_SECINFO_TCS);
+ encl_add_pages(dev_fd, 0, bin, 1, SGX_SECINFO_TCS, 0);
encl_add_pages(dev_fd, PAGE_SIZE, bin + PAGE_SIZE,
- (bin_size / PAGE_SIZE) - 1, SGX_REG_PAGE_FLAGS);
+ (bin_size / PAGE_SIZE) - 1, SGX_REG_PAGE_FLAGS, 0);
ioc.sigstruct = (uint64_t)sigstruct;
rc = ioctl(dev_fd, SGX_IOC_ENCLAVE_INIT, &ioc);
Update the call to SGX_IOC_ENCLAVE_ADD_PAGES to pass '0' for the flags, i.e. retain the existing behavior. No functional change intended. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- tools/testing/selftests/x86/sgx/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)