diff options
Diffstat (limited to 'compiler-rt/lib/safestack/safestack.cc')
-rw-r--r-- | compiler-rt/lib/safestack/safestack.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler-rt/lib/safestack/safestack.cc b/compiler-rt/lib/safestack/safestack.cc index 920b89b5e7c..673f5fd30c5 100644 --- a/compiler-rt/lib/safestack/safestack.cc +++ b/compiler-rt/lib/safestack/safestack.cc @@ -152,6 +152,7 @@ static void *thread_start(void *arg) { struct thread_stack_ll { struct thread_stack_ll *next; void *stack_base; + size_t size; pid_t pid; tid_t tid; }; @@ -183,7 +184,7 @@ static void thread_cleanup_handler(void *_iter) { while (*stackp) { thread_stack_ll *stack = *stackp; if (stack->pid != pid || TgKill(stack->pid, stack->tid, 0) == -ESRCH) { - UnmapOrDie(stack->stack_base, unsafe_stack_size + unsafe_stack_guard); + UnmapOrDie(stack->stack_base, stack->size); *stackp = stack->next; free(stack); } else @@ -193,6 +194,7 @@ static void thread_cleanup_handler(void *_iter) { thread_stack_ll *cur_stack = (thread_stack_ll *)malloc(sizeof(thread_stack_ll)); cur_stack->stack_base = (char *)unsafe_stack_start - unsafe_stack_guard; + cur_stack->size = unsafe_stack_size + unsafe_stack_guard; cur_stack->pid = pid; cur_stack->tid = tid; |