From d568cf99fd7e16fa9bdfce995c9318c8176f5dcd Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 31 Aug 2014 16:46:29 +0200 Subject: Fix stack address computation stackaddr is supposed to be an adressable byte, i.e. not inside the guard size. * pthread/pt-getattr.c (pthread_getattr_np): Take guard size into account when returning the stack bottom address. --- pthread/pt-getattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pthread') diff --git a/pthread/pt-getattr.c b/pthread/pt-getattr.c index 24599c6..edb013f 100644 --- a/pthread/pt-getattr.c +++ b/pthread/pt-getattr.c @@ -39,7 +39,9 @@ pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) are not supported yet, so fill them with our default values. */ *attr = __pthread_default_attr; - attr->stackaddr = pthread->stackaddr; + attr->stackaddr = pthread->stackaddr + + ((pthread->guardsize + __vm_page_size-1) + / __vm_page_size * __vm_page_size); attr->stacksize = pthread->stacksize; attr->guardsize = pthread->guardsize; attr->detachstate = (pthread->state == PTHREAD_DETACHED -- cgit v1.2.3