fixup! [LibOS] allocate stack dedicated for LibOS

This commit is contained in:
Isaku Yamahata
2020-01-31 21:38:30 -08:00
parent 5011d2356a
commit 65c8daf010
3 changed files with 5 additions and 8 deletions
-3
View File
@@ -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 */
+2
View File
@@ -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;
+3 -5
View File
@@ -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);