diff --git a/LibOS/shim/include/shim_defs.h b/LibOS/shim/include/shim_defs.h index b7b555eb..bb92842d 100644 --- a/LibOS/shim/include/shim_defs.h +++ b/LibOS/shim/include/shim_defs.h @@ -43,9 +43,6 @@ #define CP_INIT_VMA_SIZE (64 * 1024 * 1024) /* 64MB */ -/* syscall stack size: ALLOC_ALIGNMENT is for a guard page */ -#define SHIM_THREAD_SYSCALL_STACK_SIZE (16 * 1024 + ALLOC_ALIGNMENT) - #define ENABLE_ASLR 1 /* debug message printout */ diff --git a/LibOS/shim/include/shim_thread.h b/LibOS/shim/include/shim_thread.h index 5f5eda54..c2882326 100644 --- a/LibOS/shim/include/shim_thread.h +++ b/LibOS/shim/include/shim_thread.h @@ -107,6 +107,8 @@ struct shim_thread { unsigned long exit_time; #endif + /* syscall stack size: ALLOC_ALIGNMENT is for a guard page */ +#define SHIM_THREAD_SYSCALL_STACK_SIZE (16 * 1024 + ALLOC_ALIGNMENT) void* syscall_stack; /* allocated area for stack */ void* syscall_stack_low; void* syscall_stack_high; diff --git a/LibOS/shim/src/bookkeep/shim_thread.c b/LibOS/shim/src/bookkeep/shim_thread.c index 04726491..b83f5b5f 100644 --- a/LibOS/shim/src/bookkeep/shim_thread.c +++ b/LibOS/shim/src/bookkeep/shim_thread.c @@ -263,16 +263,14 @@ int shim_thread_alloc_syscall_stack(struct shim_thread* thread) { /* guard page for stack */ void* addr; int ret; - addr = DkVirtualMemoryAlloc( - thread->syscall_stack, SHIM_THREAD_SYSCALL_STACK_SIZE, 0, - PAL_PROT_READ | PAL_PROT_WRITE); + addr = DkVirtualMemoryAlloc(thread->syscall_stack, SHIM_THREAD_SYSCALL_STACK_SIZE, 0, + PAL_PROT_READ | PAL_PROT_WRITE); if (!addr) { ret = -PAL_ERRNO; goto out; } - PAL_BOL success = DkVirtualMemoryProtect( - thread->syscall_stack, ALLOC_ALIGNMENT, PAL_PROT_NONE); + PAL_BOL success = DkVirtualMemoryProtect(thread->syscall_stack, ALLOC_ALIGNMENT, PAL_PROT_NONE); if (!success) { ret = -PAL_ERRNO; DkVirtualMemoryFree(thread->syscall_stack, ALLOC_ALIGNMENT);