Commit 6a7171b8 authored by Jarkko Sakkinen's avatar Jarkko Sakkinen Committed by Shuah Khan

selftests/sgx: Rename 'eenter' and 'sgx_call_vdso'

Rename symbols for better clarity:

* 'eenter' might be confused for directly calling ENCLU[EENTER].  It does
  not.  It calls into the VDSO, which actually has the EENTER instruction.
* 'sgx_call_vdso' is *only* used for entering the enclave.  It's not some
  generic SGX call into the VDSO.
Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 0d3e5a05
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
.text .text
.global sgx_call_vdso .global sgx_enter_enclave
sgx_call_vdso: sgx_enter_enclave:
.cfi_startproc .cfi_startproc
push %r15 push %r15
.cfi_adjust_cfa_offset 8 .cfi_adjust_cfa_offset 8
...@@ -27,7 +27,7 @@ sgx_call_vdso: ...@@ -27,7 +27,7 @@ sgx_call_vdso:
.cfi_adjust_cfa_offset 8 .cfi_adjust_cfa_offset 8
push 0x38(%rsp) push 0x38(%rsp)
.cfi_adjust_cfa_offset 8 .cfi_adjust_cfa_offset 8
call *eenter(%rip) call *vdso_sgx_enter_enclave(%rip)
add $0x10, %rsp add $0x10, %rsp
.cfi_adjust_cfa_offset -0x10 .cfi_adjust_cfa_offset -0x10
pop %rbx pop %rbx
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "../kselftest.h" #include "../kselftest.h"
static const uint64_t MAGIC = 0x1122334455667788ULL; static const uint64_t MAGIC = 0x1122334455667788ULL;
vdso_sgx_enter_enclave_t eenter; vdso_sgx_enter_enclave_t vdso_sgx_enter_enclave;
struct vdso_symtab { struct vdso_symtab {
Elf64_Sym *elf_symtab; Elf64_Sym *elf_symtab;
...@@ -149,7 +149,7 @@ int main(int argc, char *argv[]) ...@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
{ {
struct sgx_enclave_run run; struct sgx_enclave_run run;
struct vdso_symtab symtab; struct vdso_symtab symtab;
Elf64_Sym *eenter_sym; Elf64_Sym *sgx_enter_enclave_sym;
uint64_t result = 0; uint64_t result = 0;
struct encl encl; struct encl encl;
unsigned int i; unsigned int i;
...@@ -194,29 +194,30 @@ int main(int argc, char *argv[]) ...@@ -194,29 +194,30 @@ int main(int argc, char *argv[])
if (!vdso_get_symtab(addr, &symtab)) if (!vdso_get_symtab(addr, &symtab))
goto err; goto err;
eenter_sym = vdso_symtab_get(&symtab, "__vdso_sgx_enter_enclave"); sgx_enter_enclave_sym = vdso_symtab_get(&symtab, "__vdso_sgx_enter_enclave");
if (!eenter_sym) if (!sgx_enter_enclave_sym)
goto err; goto err;
eenter = addr + eenter_sym->st_value; vdso_sgx_enter_enclave = addr + sgx_enter_enclave_sym->st_value;
ret = sgx_call_vdso((void *)&MAGIC, &result, 0, EENTER, NULL, NULL, &run); ret = sgx_enter_enclave((void *)&MAGIC, &result, 0, EENTER,
if (!report_results(&run, ret, result, "sgx_call_vdso")) NULL, NULL, &run);
if (!report_results(&run, ret, result, "sgx_enter_enclave_unclobbered"))
goto err; goto err;
/* Invoke the vDSO directly. */ /* Invoke the vDSO directly. */
result = 0; result = 0;
ret = eenter((unsigned long)&MAGIC, (unsigned long)&result, 0, EENTER, ret = vdso_sgx_enter_enclave((unsigned long)&MAGIC, (unsigned long)&result,
0, 0, &run); 0, EENTER, 0, 0, &run);
if (!report_results(&run, ret, result, "eenter")) if (!report_results(&run, ret, result, "sgx_enter_enclave"))
goto err; goto err;
/* And with an exit handler. */ /* And with an exit handler. */
run.user_handler = (__u64)user_handler; run.user_handler = (__u64)user_handler;
run.user_data = 0xdeadbeef; run.user_data = 0xdeadbeef;
ret = eenter((unsigned long)&MAGIC, (unsigned long)&result, 0, EENTER, ret = vdso_sgx_enter_enclave((unsigned long)&MAGIC, (unsigned long)&result,
0, 0, &run); 0, EENTER, 0, 0, &run);
if (!report_results(&run, ret, result, "user_handler")) if (!report_results(&run, ret, result, "user_handler"))
goto err; goto err;
......
...@@ -35,7 +35,7 @@ bool encl_load(const char *path, struct encl *encl); ...@@ -35,7 +35,7 @@ bool encl_load(const char *path, struct encl *encl);
bool encl_measure(struct encl *encl); bool encl_measure(struct encl *encl);
bool encl_build(struct encl *encl); bool encl_build(struct encl *encl);
int sgx_call_vdso(void *rdi, void *rsi, long rdx, u32 function, void *r8, void *r9, int sgx_enter_enclave(void *rdi, void *rsi, long rdx, u32 function, void *r8, void *r9,
struct sgx_enclave_run *run); struct sgx_enclave_run *run);
#endif /* MAIN_H */ #endif /* MAIN_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment