@@ -19,7 +19,7 @@
#include "main.h"
static const uint64_t MAGIC = 0x1122334455667788ULL;
-void *eenter;
+vdso_sgx_enter_enclave_t eenter;
struct vdso_symtab {
Elf64_Sym *elf_symtab;
@@ -173,15 +173,27 @@ int main(int argc, char *argv[], char *envp[])
sgx_call_vdso((void *)&MAGIC, &result, 0, EENTER, NULL, NULL,
(void *)encl.encl_base, &exception, NULL);
- if (result != MAGIC)
+ if (result != MAGIC) {
+ printf("FAIL: sgx_call_vdso(), expected: 0x%lx, got: 0x%lx\n",
+ MAGIC, result);
goto err;
+ }
+
+ /* Invoke the vDSO directly. */
+ result = 0;
+ eenter((unsigned long)&MAGIC, (unsigned long)&result, 0, EENTER, 0, 0,
+ (void *)encl.encl_base, &exception, NULL);
+ if (result != MAGIC) {
+ printf("FAIL: eenter(), expected: 0x%lx, got: 0x%lx\n",
+ MAGIC, result);
+ goto err;
+ }
printf("SUCCESS\n");
encl_delete(&encl);
exit(0);
err:
- printf("FAILURE\n");
encl_delete(&encl);
exit(1);
}
Add a selftest to call __vsgx_enter_enclave() from C. Suggested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- tools/testing/selftests/sgx/main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)