浏览代码

[Pal/Linux-SGX] Increase MAX_DBG_THREADS constant from 64 to 1024

An internal Graphene structure for GDB metadata limits the number of
enclave threads to MAX_DBG_THREADS. Previously, it was set to 64,
which was enough for typical platforms. However, powerful servers
have hundreds of logical cores. Graphene-SGX failed with error on such
servers. This commit increases the limit to 1024.
Dmitrii Kuvaiskii 6 年之前
父节点
当前提交
fe7a603bf3
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 1 1
      Pal/src/host/Linux-SGX/debugger/sgx_gdb.h
  2. 3 1
      Pal/src/host/Linux-SGX/sgx_main.c

+ 1 - 1
Pal/src/host/Linux-SGX/debugger/sgx_gdb.h

@@ -1,4 +1,4 @@
-#define MAX_DBG_THREADS 64
+#define MAX_DBG_THREADS 1024
 
 /* This address is shared between our GDB and Graphene-SGX and must
  * reside in non-enclave memory. Graphene-SGX puts an enclave_dbginfo

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

@@ -234,9 +234,11 @@ int initialize_enclave (struct pal_enclave * enclave)
     sgx_arch_enclave_css_t enclave_sigstruct;
     sgx_arch_secs_t        enclave_secs;
     unsigned long          enclave_entry_addr;
-    void*                  tcs_addrs[MAX_DBG_THREADS];
     unsigned long          heap_min = DEFAULT_HEAP_MIN;
 
+    /* this array may overflow the stack, so we allocate it in BSS */
+    static void* tcs_addrs[MAX_DBG_THREADS];
+
     enclave_image = INLINE_SYSCALL(open, 3, ENCLAVE_FILENAME, O_RDONLY, 0);
     if (IS_ERR(enclave_image)) {
         SGX_DBG(DBG_E, "Cannot find %s\n", ENCLAVE_FILENAME);