From f39ffd0c8825c3663e54c2f4f8ad1ae365b8123b Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 18 May 2023 09:11:10 +0300 Subject: [PATCH] Fix alt-stack handling in GC_push_all_stacks if stack grows up (a cherry-pick of commit 9229da044 from 'master') * pthread_stop_world.c [STACK_GROWS_UP] (GC_push_all_stacks): Set hi to p->altstack (instead of p->altstack+p->altstack_size) if lo is inside altstack; remove relevant FIXME item. --- pthread_stop_world.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pthread_stop_world.c b/pthread_stop_world.c index fbccc29ab..64013e12a 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -862,9 +862,12 @@ GC_INNER void GC_push_all_stacks(void) if (0 == lo) ABORT("GC_push_all_stacks: sp not set!"); if (p->altstack != NULL && (word)p->altstack <= (word)lo && (word)lo <= (word)p->altstack + p->altstack_size) { - hi = p->altstack + p->altstack_size; +# ifdef STACK_GROWS_UP + hi = p->altstack; +# else + hi = p->altstack + p->altstack_size; +# endif /* FIXME: Need to scan the normal stack too, but how ? */ - /* FIXME: Assume stack grows down */ } GC_push_all_stack_sections(lo, hi, traced_stack_sect); # ifdef STACK_GROWS_UP