mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-06 13:51:28 +00:00
fixup! [LibOS] allocate stack dedicated for LibOS
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user