Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 53999)
+++ thread_pthread.c	(revision 54000)
@@ -619,7 +619,10 @@
 				   &thinfo, sizeof(thinfo),
 				   &reg, &regsiz));
     *addr = thinfo.__pi_stackaddr;
-    *size = thinfo.__pi_stacksize;
+    /* Must not use thinfo.__pi_stacksize for size.
+       It is around 3KB smaller than the correct size
+       calculated by thinfo.__pi_stackend - thinfo.__pi_stackaddr. */
+    *size = thinfo.__pi_stackend - thinfo.__pi_stackaddr;
     STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size));
 #elif defined __HAIKU__
     thread_info info;
