summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-08-31 16:46:29 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-08-31 16:46:29 +0200
commitd568cf99fd7e16fa9bdfce995c9318c8176f5dcd (patch)
treea4f884240138f7a921d2b339b8407f5bccf14d53
parentbd3ccc49712dc44911bf0913ca49815f59747d6f (diff)
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.
-rw-r--r--pthread/pt-getattr.c4
1 files changed, 3 insertions, 1 deletions
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