From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Nathaniel McCallum <npmccallum@redhat.com>,
Cedric Xing <cedric.xing@intel.com>,
Jethro Beekman <jethro@fortanix.com>,
Andy Lutomirski <luto@amacapital.net>,
linux-sgx@vger.kernel.org
Subject: [PATCH for_v37 4/6] selftests/sgx: Update the SGX selftest to match the reworked vDSO API
Date: Fri, 4 Sep 2020 03:44:35 -0700 [thread overview]
Message-ID: <20200904104437.29555-5-sean.j.christopherson@intel.com> (raw)
In-Reply-To: <20200904104437.29555-1-sean.j.christopherson@intel.com>
Update the call to __vdso_sgx_enter_enclave() to use the sgx_enclave_run
struct instead of cramming parameters into the function call itself.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
tools/testing/selftests/sgx/call.S | 10 +++-------
tools/testing/selftests/sgx/main.c | 11 +++++------
tools/testing/selftests/sgx/main.h | 2 +-
3 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/tools/testing/selftests/sgx/call.S b/tools/testing/selftests/sgx/call.S
index 77131e83db424..c4837965dfbb4 100644
--- a/tools/testing/selftests/sgx/call.S
+++ b/tools/testing/selftests/sgx/call.S
@@ -31,15 +31,11 @@ sgx_call_vdso:
.cfi_rel_offset %rbx, 0
push $0
.cfi_adjust_cfa_offset 8
- push 0x48(%rsp)
- .cfi_adjust_cfa_offset 8
- push 0x48(%rsp)
- .cfi_adjust_cfa_offset 8
- push 0x48(%rsp)
+ push 0x38(%rsp)
.cfi_adjust_cfa_offset 8
call *eenter(%rip)
- add $0x20, %rsp
- .cfi_adjust_cfa_offset -0x20
+ add $0x10, %rsp
+ .cfi_adjust_cfa_offset -0x10
pop %rbx
.cfi_adjust_cfa_offset -8
pop %r12
diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c
index 8d95569e7a66f..17f36e590fbd2 100644
--- a/tools/testing/selftests/sgx/main.c
+++ b/tools/testing/selftests/sgx/main.c
@@ -125,7 +125,7 @@ static Elf64_Sym *vdso_symtab_get(struct vdso_symtab *symtab, const char *name)
int main(int argc, char *argv[], char *envp[])
{
- struct sgx_enclave_exception exception;
+ struct sgx_enclave_run run;
struct vdso_symtab symtab;
Elf64_Sym *eenter_sym;
uint64_t result = 0;
@@ -156,7 +156,8 @@ int main(int argc, char *argv[], char *envp[])
}
}
- memset(&exception, 0, sizeof(exception));
+ memset(&run, 0, sizeof(run));
+ run.tcs = encl.encl_base;
addr = vdso_get_base_addr(envp);
if (!addr)
@@ -171,8 +172,7 @@ int main(int argc, char *argv[], char *envp[])
eenter = addr + eenter_sym->st_value;
- sgx_call_vdso((void *)&MAGIC, &result, 0, EENTER, NULL, NULL,
- (void *)encl.encl_base, &exception, NULL);
+ sgx_call_vdso((void *)&MAGIC, &result, 0, EENTER, NULL, NULL, &run);
if (result != MAGIC) {
printf("FAIL: sgx_call_vdso(), expected: 0x%lx, got: 0x%lx\n",
MAGIC, result);
@@ -181,8 +181,7 @@ int main(int argc, char *argv[], char *envp[])
/* Invoke the vDSO directly. */
result = 0;
- eenter((unsigned long)&MAGIC, (unsigned long)&result, 0, EENTER, 0, 0,
- (void *)encl.encl_base, &exception, NULL);
+ eenter((unsigned long)&MAGIC, (unsigned long)&result, 0, EENTER, 0, 0, &run);
if (result != MAGIC) {
printf("FAIL: eenter(), expected: 0x%lx, got: 0x%lx\n",
MAGIC, result);
diff --git a/tools/testing/selftests/sgx/main.h b/tools/testing/selftests/sgx/main.h
index 999422cc73438..2b4777942500f 100644
--- a/tools/testing/selftests/sgx/main.h
+++ b/tools/testing/selftests/sgx/main.h
@@ -33,6 +33,6 @@ bool encl_measure(struct encl *encl);
bool encl_build(struct encl *encl);
int sgx_call_vdso(void *rdi, void *rsi, long rdx, u32 leaf, void *r8, void *r9,
- void *tcs, struct sgx_enclave_exception *ei, void *cb);
+ struct sgx_enclave_run *run);
#endif /* MAIN_H */
--
2.28.0
next prev parent reply other threads:[~2020-09-04 10:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 10:44 [PATCH for_v37 0/6] x86/vdso: x86/sgx: Rework SGX vDSO API Sean Christopherson
2020-09-04 10:44 ` [PATCH for_v37 1/6] x86/vdso: x86/sgx: Explicitly force 8-byte CMP for detecting user handler Sean Christopherson
2020-09-04 10:44 ` [PATCH for_v37 2/6] x86/vdso: x86/sgx: Rework __vdso_sgx_enter_enclave() API Sean Christopherson
2020-09-04 13:46 ` Jarkko Sakkinen
2020-09-04 10:44 ` [PATCH for_v37 3/6] x86/vdso: x86/sgx: Introduce dedicated SGX exit reasons for vDSO Sean Christopherson
2020-09-04 14:06 ` Jarkko Sakkinen
2020-09-04 10:44 ` Sean Christopherson [this message]
2020-09-04 14:07 ` [PATCH for_v37 4/6] selftests/sgx: Update the SGX selftest to match the reworked vDSO API Jarkko Sakkinen
2020-09-04 10:44 ` [PATCH for_v37 5/6] selftests/sgx: Sanity check the return value of the vDSO call Sean Christopherson
2020-09-04 14:07 ` Jarkko Sakkinen
2020-09-04 10:44 ` [PATCH for_v37 6/6] selftests/sgx: Add a smoke test to ensure the user handler is invoked Sean Christopherson
2020-09-04 14:10 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200904104437.29555-5-sean.j.christopherson@intel.com \
--to=sean.j.christopherson@intel.com \
--cc=cedric.xing@intel.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=jethro@fortanix.com \
--cc=linux-sgx@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=npmccallum@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).