diff options
-rw-r--r-- | pthread/pt-create.c | 5 | ||||
-rw-r--r-- | sysdeps/mach/pt-thread-terminate.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/pthread/pt-create.c b/pthread/pt-create.c index 00884b5..78dd17e 100644 --- a/pthread/pt-create.c +++ b/pthread/pt-create.c @@ -227,7 +227,10 @@ __pthread_create_internal (struct __pthread **thread, goto failed; failed_thread_alloc: if (pthread->stack) - __pthread_stack_dealloc (pthread->stackaddr, pthread->stacksize); + __pthread_stack_dealloc (pthread->stackaddr, + ((setup->guardsize + __vm_page_size-1) + / __vm_page_size) * __vm_page_size + + pthread->stacksize); failed_stack_alloc: __pthread_dealloc (pthread); failed: diff --git a/sysdeps/mach/pt-thread-terminate.c b/sysdeps/mach/pt-thread-terminate.c index 6672065..cb9e26a 100644 --- a/sysdeps/mach/pt-thread-terminate.c +++ b/sysdeps/mach/pt-thread-terminate.c @@ -42,7 +42,9 @@ __pthread_thread_terminate (struct __pthread *thread) if (thread->stack) { stackaddr = thread->stackaddr; - stacksize = thread->stacksize; + stacksize = ((thread->guardsize + __vm_page_size-1) + / __vm_page_size) * __vm_page_size + + thread->stacksize; } else { |