Przeglądaj źródła

[Pal/Linux-SGX] Cleanups of db_exception.c and sgx_main.c

This commit introduces tiny cleanups in preparation for signal handler's
stack in Linux-SGX PAL:
- Remove arch_exception_return() dead code in db_exception.c
- Initialize pal_sec.enclave_attributes correctly in sgx_main.c
- Use skip_eextend=false during add_pages_to_enclave() in sgx_main.c
Isaku Yamahata 5 lat temu
rodzic
commit
a647a26c02

+ 0 - 20
Pal/src/host/Linux-SGX/db_exception.c

@@ -101,26 +101,6 @@ static struct pal_frame * get_frame (sgx_cpu_context_t * uc)
     return NULL;
 }
 
-__asm__ (".type arch_exception_return_asm, @function;"
-     "arch_exception_return_asm:"
-     "  pop %rax;"
-     "  pop %rbx;"
-     "  pop %rcx;"
-     "  pop %rdx;"
-     "  pop %rsi;"
-     "  pop %rdi;"
-     "  pop %r8;"
-     "  pop %r9;"
-     "  pop %r10;"
-     "  pop %r11;"
-     "  pop %r12;"
-     "  pop %r13;"
-     "  pop %r14;"
-     "  pop %r15;"
-     "  retq;");
-
-extern void arch_exception_return (void) __asm__ ("arch_exception_return_asm");
-
 /*
  * return value:
  *  true:  #UD is handled.

+ 2 - 1
Pal/src/host/Linux-SGX/sgx_main.c

@@ -210,7 +210,7 @@ int load_enclave_binary (sgx_arch_secs_t * secs, int fd,
 
             ret = add_pages_to_enclave(secs, (void *) base + c->mapstart, addr,
                                        c->mapend - c->mapstart,
-                                       SGX_PAGE_REG, c->prot, 0,
+                                       SGX_PAGE_REG, c->prot, /*skip_eextend=*/false,
                                        (c->prot & PROT_EXEC) ? "code" : "data");
 
             INLINE_SYSCALL(munmap, 2, addr, c->mapend - c->mapstart);
@@ -309,6 +309,7 @@ int initialize_enclave (struct pal_enclave * enclave)
         SGX_DBG(DBG_E, "Reading enclave token failed: %d\n", -ret);
         goto out;
     }
+    enclave->pal_sec.enclave_attributes = enclave_token.body.attributes;
 
     ret = read_enclave_sigstruct(enclave->sigfile, &enclave_sigstruct);
     if (ret < 0) {