[PATCH] Fix false positives in tst-pthread-getattr test case
Siddhesh Poyarekar
siddhesh@redhat.com
Tue Jun 26 07:28:00 GMT 2012
Hi,
Here's a patch that fixes the test case to remove the false-positives
most of us were getting in the result. Like I said in an earlier
thread, it does not mean that the bug has not been fixed -- just that
the test case was wrong.
In some cases, the compiler would optimize out the call to
allocate_and_test and thus result in a false positive for the test
case. Another problem was the fact that the compiler could move the
stack pointer beyond what we expect, resulting in the alloca call moving
the stack pointer beyond what is allowed by the rlimit. Hence,
accessing the stackaddr returned by pthread_getattr_np is safer than
relying on the alloca'd result.
The problem that Carlos reported still remains. I have seen this crash
occasionally after fixing the above and here's what is happening in my
case:
* The rlim_cur is returned as unlimited (-1)
* The test case sets the rlimit to the distance to the previous vma,
which is quite large
* Since most systems are set with vm.overcommit_memory sysctl set to 0
(heuristic overcommit), the heuristic fails for such a large value
and hence results in a segfault.
Setting vm.overcommit_memory to 1 (always overcommit) fixes this crash.
As for where RLIMIT_STACK is being set as unlimited, it is definitely
not anything within glibc. The kernel, shell or make may be to blame
for it, the kernel being the most likely culprit.
Regards,
Siddhesh
nptl/ChangeLog:
2012-06-26 Siddhesh poyarekar <siddhesh@redhat.com>
[BZ #12416]
* tst-pthread-getattr.c (allocate_and_test): Return STACKADDR.
Access STACKADDR instead of MEM to test.
(check_stack_top): Read valued written into STACKADDR in
allocate_and_test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread-getattr-testcase.patch
Type: text/x-patch
Size: 1771 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120626/62d29dfe/attachment.bin>
More information about the Libc-alpha
mailing list