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: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
committed by
Shuah Khan
parent
0d3e5a0579
commit
6a7171b8a0
@@ -21,7 +21,7 @@
|
||||
#include "../kselftest.h"
|
||||
|
||||
static const uint64_t MAGIC = 0x1122334455667788ULL;
|
||||
vdso_sgx_enter_enclave_t eenter;
|
||||
vdso_sgx_enter_enclave_t vdso_sgx_enter_enclave;
|
||||
|
||||
struct vdso_symtab {
|
||||
Elf64_Sym *elf_symtab;
|
||||
@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
struct sgx_enclave_run run;
|
||||
struct vdso_symtab symtab;
|
||||
Elf64_Sym *eenter_sym;
|
||||
Elf64_Sym *sgx_enter_enclave_sym;
|
||||
uint64_t result = 0;
|
||||
struct encl encl;
|
||||
unsigned int i;
|
||||
@@ -194,29 +194,30 @@ int main(int argc, char *argv[])
|
||||
if (!vdso_get_symtab(addr, &symtab))
|
||||
goto err;
|
||||
|
||||
eenter_sym = vdso_symtab_get(&symtab, "__vdso_sgx_enter_enclave");
|
||||
if (!eenter_sym)
|
||||
sgx_enter_enclave_sym = vdso_symtab_get(&symtab, "__vdso_sgx_enter_enclave");
|
||||
if (!sgx_enter_enclave_sym)
|
||||
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);
|
||||
if (!report_results(&run, ret, result, "sgx_call_vdso"))
|
||||
ret = sgx_enter_enclave((void *)&MAGIC, &result, 0, EENTER,
|
||||
NULL, NULL, &run);
|
||||
if (!report_results(&run, ret, result, "sgx_enter_enclave_unclobbered"))
|
||||
goto err;
|
||||
|
||||
|
||||
/* Invoke the vDSO directly. */
|
||||
result = 0;
|
||||
ret = eenter((unsigned long)&MAGIC, (unsigned long)&result, 0, EENTER,
|
||||
0, 0, &run);
|
||||
if (!report_results(&run, ret, result, "eenter"))
|
||||
ret = vdso_sgx_enter_enclave((unsigned long)&MAGIC, (unsigned long)&result,
|
||||
0, EENTER, 0, 0, &run);
|
||||
if (!report_results(&run, ret, result, "sgx_enter_enclave"))
|
||||
goto err;
|
||||
|
||||
/* And with an exit handler. */
|
||||
run.user_handler = (__u64)user_handler;
|
||||
run.user_data = 0xdeadbeef;
|
||||
ret = eenter((unsigned long)&MAGIC, (unsigned long)&result, 0, EENTER,
|
||||
0, 0, &run);
|
||||
ret = vdso_sgx_enter_enclave((unsigned long)&MAGIC, (unsigned long)&result,
|
||||
0, EENTER, 0, 0, &run);
|
||||
if (!report_results(&run, ret, result, "user_handler"))
|
||||
goto err;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user