aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn David Anglin <danglin@gcc.gnu.org>2025-01-29 16:51:16 -0500
committerJohn David Anglin <danglin@gcc.gnu.org>2025-02-02 17:46:24 -0500
commitcb7f20653724029be89224ed3a35d627cc5b4163 (patch)
tree02c9b49b25c9b268cdba1087ddb74347459dbdae
parentd85a7719536f4892f2b53d4594e18f6d096c2882 (diff)
downloadglibc-cb7f20653724029be89224ed3a35d627cc5b4163.zip
glibc-cb7f20653724029be89224ed3a35d627cc5b4163.tar.gz
glibc-cb7f20653724029be89224ed3a35d627cc5b4163.tar.bz2
nptl: Correct stack size attribute when stack grows up [BZ #32574]
Set stack size attribute to the size of the mmap'd region only when the size of the remaining stack space is less than the size of the mmap'd region. This was reversed. As a result, the initial stack size was only 135168 bytes. On architectures where the stack grows down, the initial stack size is approximately 8384512 bytes with the default rlimit settings. The small main stack size on hppa broke applications like ruby that check for stack overflows. Signed-off-by: John David Anglin <dave.anglin@bell.net>
-rw-r--r--nptl/pthread_getattr_np.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/nptl/pthread_getattr_np.c b/nptl/pthread_getattr_np.c
index e98e2df..43dd16d 100644
--- a/nptl/pthread_getattr_np.c
+++ b/nptl/pthread_getattr_np.c
@@ -145,9 +145,9 @@ __pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr)
> (size_t) iattr->stackaddr - last_to)
iattr->stacksize = (size_t) iattr->stackaddr - last_to;
#else
- /* The limit might be too high. */
+ /* The limit might be too low. */
if ((size_t) iattr->stacksize
- > to - (size_t) iattr->stackaddr)
+ < to - (size_t) iattr->stackaddr)
iattr->stacksize = to - (size_t) iattr->stackaddr;
#endif
/* We succeed and no need to look further. */