[PATCH] Fix stacksize returned for main process thread when RLIMIT_STACK is relevant
Siddhesh Poyarekar
siddhesh@redhat.com
Thu Jun 14 19:29:00 GMT 2012
Hi,
This patch is a follow-up to the discussion:
http://sourceware.org/ml/libc-alpha/2012-06/msg00310.html
The stacksize returned by pthread_getattr_np is incorrect if the
stacksize computed is based on rlimit since it should be adjusted
against the pages we skip above __libc_stack_end. Further, if the
stacksize is based on rlimit, it should be truncated to align to page
size because the rlimit may not necessarily be page aligned.
I have added a test case that verifies that the stack can extend up to
the returned stackaddr for the main thread. Once the thread stack size
issue is fixed, an analogous check can be added in the same test case
for thread stacks too. I have verified that there are no regressions in
the testsuite resulting from this change.
Regards,
Siddhesh
nptl/ChangeLog:
2012-06-15 Siddhesh Poyarekar <siddhesh@redhat.com>
* Makefile (tests): Add test case.
* pthread_getattr_np.c (pthread_getattr_np): Deduct pages below
the __libc_stack_end page from stacksize. Truncate stacksize to
make it page aligned when it is computed from RLIMIT_STACK.
* tst-pthread-getattr.c: New test case. Verify that stackaddr is
accessible.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread-getattr.patch
Type: text/x-patch
Size: 4306 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120614/54aaa934/attachment.bin>
More information about the Libc-alpha
mailing list