From patchwork Wed Oct 9 04:42:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 11180483 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 11D7019A2 for ; Wed, 9 Oct 2019 04:42:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E7326218DE for ; Wed, 9 Oct 2019 04:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729472AbfJIEmo (ORCPT ); Wed, 9 Oct 2019 00:42:44 -0400 Received: from mga11.intel.com ([192.55.52.93]:6367 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729658AbfJIEmo (ORCPT ); Wed, 9 Oct 2019 00:42:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Oct 2019 21:42:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,273,1566889200"; d="scan'208";a="218504430" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.41]) by fmsmga004.fm.intel.com with ESMTP; 08 Oct 2019 21:42:43 -0700 From: Sean Christopherson To: Jarkko Sakkinen Cc: linux-sgx@vger.kernel.org Subject: [PATCH for_v23 6/7] selftests/x86/sgx: Update selftest to account for ADD_PAGES flag Date: Tue, 8 Oct 2019 21:42:40 -0700 Message-Id: <20191009044241.3591-7-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20191009044241.3591-1-sean.j.christopherson@intel.com> References: <20191009044241.3591-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Sender: linux-sgx-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org 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 --- tools/testing/selftests/x86/sgx/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/x86/sgx/main.c b/tools/testing/selftests/x86/sgx/main.c index 4b652fd800f5..0921aeda9942 100644 --- a/tools/testing/selftests/x86/sgx/main.c +++ b/tools/testing/selftests/x86/sgx/main.c @@ -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);