Browse Source

Fix SGX Pal regression by defining an expected behavior for NULL URI to DkProcessCreate.

Don Porter 7 years ago
parent
commit
b926dfec43
2 changed files with 16 additions and 2 deletions
  1. 7 0
      Pal/src/db_process.c
  2. 9 2
      Pal/src/host/Linux-SGX/sgx_framework.c

+ 7 - 0
Pal/src/db_process.c

@@ -40,6 +40,13 @@ DkProcessCreate (PAL_STR uri, PAL_FLG flags, PAL_STR * args)
 {
     ENTER_PAL_CALL(DkProcessCreate);
 
+    /* DEP 3/22/17: There seems to be a default semantics that 
+     * a NULL URI should replicate the parent. I think we may want
+     * this to become an error in the future, but keep the behavior
+     * for now, and make it consistent across hosts. */
+    if (!uri)
+        uri = pal_control.executable;
+    
     log_stream(uri);
 
     PAL_HANDLE handle = NULL;

+ 9 - 2
Pal/src/host/Linux-SGX/sgx_framework.c

@@ -311,8 +311,15 @@ int init_enclave(sgx_arch_secs_t * secs,
     }
 
     if (ret) {
-        SGX_DBG(DBG_I, "enclave EINIT failed\n");
-        return -EPERM;
+        /* DEP 3/22/17: Try to improve error messages */
+        switch(ret) {
+        case 4:
+            SGX_DBG(DBG_I, "enclave EINIT failed - Invalid Measurement\n");
+            break;
+        default:
+            SGX_DBG(DBG_I, "enclave EINIT failed - %d\n", ret);
+        }
+        return -EPERM; 
     }
 
     return 0;