Commit Graph

215 Commits

Author SHA1 Message Date
Carlos O'Donell f8bf15febc Bug 20116: Fix use after free in pthread_create()
The commit documents the ownership rules around 'struct pthread' and
when a thread can read or write to the descriptor. With those ownership
rules in place it becomes obvious that pd->stopped_start should not be
touched in several of the paths during thread startup, particularly so
for detached threads. In the case of detached threads, between the time
the thread is created by the OS kernel and the creating thread checks
pd->stopped_start, the detached thread might have already exited and the
memory for pd unmapped. As a regression test we add a simple test which
exercises this exact case by quickly creating detached threads with
large enough stacks to ensure the thread stack cache is bypassed and the
stacks are unmapped. Before the fix the testcase segfaults, after the
fix it works correctly and completes without issue.

For a detailed discussion see:
https://www.sourceware.org/ml/libc-alpha/2017-01/msg00505.html
2017-01-28 19:21:44 -05:00
Florian Weimer faf0e9c841 nptl: Add tst-robust-fork 2017-01-27 06:53:20 +01:00
Florian Weimer 73dfd08893 support: struct netent portability fix for support_format_netent 2017-01-01 09:35:45 +01:00
Florian Weimer 8e2c31b57f support: Use %td for pointer difference in xwrite 2017-01-01 09:27:54 +01:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Florian Weimer 5840c75c2d resolv: Add beginnings of a libresolv test suite 2016-12-31 18:52:32 +01:00
Florian Weimer f47ae51866 support: Implement --verbose option for test programs
Some tests can produce rather verbose tracing information,
and the --verbose option provides a standardized way to enable
such logging output.
2016-12-31 18:51:15 +01:00
Florian Weimer 039c5a05cc support: Use support_record_failure consistently
This causes more test programs to link in the support_record_failure
function, which triggers an early call to mmap from an ELF
constructor, but this should not have side effects intefering
with the functionality actually under test (unlike, say, a call
to malloc).
2016-12-31 18:51:15 +01:00
Florian Weimer 5707a64d94 support: Helper functions for entering namespaces 2016-12-31 18:51:07 +01:00
Joseph Myers ef83c83a25 Fix tst-support_record_failure-2 for run-built-tests = no.
The support/tst-support_record_failure-2.out test attempts to run
built code even if run-built-tests = no, so failing with
build-many-glibcs.py for all architectures whose code cannot be run on
the system running the script.  This patch disables the test in that
case.

Tested for x86_64 (native), and for aarch64 with build-many-glibcs.py.

	* support/Makefile (tests-special): Make definition conditional on
	[$(run-built-tests) = yes].
	($(objpfx)tst-support_record_failure-2.out): Make rule conditional
	on [$(run-built-tests) = yes].
2016-12-30 13:01:44 +00:00
Adhemerval Zanella 59c900c54b Add SYSV message queue test
This patch adds a simple SYSV message queue test to check for correct
argument passing on kernel.  The idea is neither to be an extensive
testing nor to check for any specific Linux test.

	* sysvipc/Makefile (tests): Add test-sysvmsg.
	* sysvipc/test-sysvmsg.c: New file.
	* test-skeleton.c (FAIL_UNSUPPORTED): New define.
2016-12-28 20:30:59 -02:00
Florian Weimer 5f0b843790 support: Add support for delayed test failure reporting
The new functions support_record_failure records a test failure,
but does not terminate the process.  The macros TEST_VERIFY
and TEST_VERIFY_EXIT check that a condition is true.
2016-12-28 13:37:18 +01:00
Andreas Schwab 67f779f1ea Fix assertion failure on test timeout 2016-12-15 17:25:12 +01:00
Andreas Schwab fea34d51e0 Fix testsuite timeout handling 2016-12-10 16:22:01 +01:00
Florian Weimer c23de0aacb support: Introduce new subdirectory for test infrastructure
The new test driver in <support/test-driver.c> has feature parity with
the old one.  The main difference is that its hooking mechanism is
based on functions and function pointers instead of macros.  This
commit also implements a new environment variable, TEST_COREDUMPS,
which disables the code which disables coredumps (that is, it enables
them if the invocation environment has not disabled them).

<test-skeleton.c> defines wrapper functions so that it is possible to
use existing macros with the new-style hook functionality.

This commit changes only a few test cases to the new test driver, to
make sure that it works as expected.
2016-12-09 08:18:27 +01:00