Module Name: src Committed By: martin Date: Thu Apr 12 13:02:21 UTC 2018
Modified Files: src/tests/lib/libc/sys [netbsd-8]: msg.h t_ptrace_wait.c t_ptrace_wait.h t_ptrace_x86_wait.h Log Message: Pull up following revision(s) (requested by kamil in ticket #711): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.24-1.31 tests/lib/libc/sys/t_ptrace_wait.h: revision 1.2 tests/lib/libc/sys/t_ptrace_x86_wait.h: revision 1.4,1.5 tests/lib/libc/sys/msg.h: revision 1.2 Correct all ATF failures in t_ptrace_x86_wait.h (debug registers) This code after refactoring stopped calling functions that were designed to trigger expected behavior and thus, tests were breaking. Sponsored by <The NetBSD Foundation> ATF: Correct a race bug in attach2 (t_ptrace_wait*) At the end of the test we resume a tracer and expect to observe it to collect the debuggee. We cannot from a parent point of view wait for collecting it with WNOHANG without a race. Remove the WNOHANG option from wait*(2) call. This corrects one type of race. This test is still racy for some other and unknown reason and this is bei= ng investigated. Sponsored by <The NetBSD Foundation> ATF: Reenable attach2 in t_ptrace_wait* The primary race specific to this test has been fixed in previous commit (wrong WNOHANG). This test is still racy and breaks like once every 30,000 execution. This is down like from once from every 100th execution in the past. The remaning race is not specific to attach2 and I can reproduce it with at least attach1. It still looks like being specific to NetBSD and it's not reproducible on Linux and FreeBSD. Perhaps a bug with pipe(2)/write(2= )/ read(2) or close to these features. Sponsored by <The NetBSD Foundation> Add a new function in ATF t_ptrace_wait*: await_zombie_raw() Add await_zombie_raw() that is the same as await_zombie(), whith an addition of additional "useconds_t ms" parameter indicating delays betwee= n new polling for a zombie process. This new function will be used for testing a race condition that has been= observed occassionally crashing a test case -- returning duplicate entrie= s for KERN_PROC_PID. Sponsored by <The NetBSD Foundation> ATF t_ptrace_wait*: Disable debug messages in msg.h msg.h is a dummy IPC interface. Disable additional debugging logging here, especially wanted in race* tests. Sponsored by <The NetBSD Foundation> ATF: Add new test race1 in t_ptrace_wait* Reuse the attach1's test body for race1. Add a new test race1: Assert that await_zombie() in attach1 always finds a single process and no other error is reported race1 requires HAVE_PID in wait(2)-like function. This test is executed in a loop for 5 seconds (16k iterations on Intel i7= ). A buggy kernel was asserting an error within this timeframe almost always= =2E The bug in the kernel is now gone and this test is expected to pass correctly. Sponsored by <The NetBSD Foundation> Add check in ATF tests for security.models.extensions.user_set_dbregs Introduce a new function can_we_set_dbregs() in the ATF ptrace(2) tests. It uses lazy-bool evaluation whether a process can call PT_SETDBREGS. In case of not being able to do so, print a message and mark a test as skipped: Either run this test as root or set sysctl(3) security.models.extensions.user_set_dbregs to 1 No functional change intended to the code flow of the existing tested scenarios. Sponsored by <The NetBSD Foundation> Improve documentation of the ATF test t_ptrace_wait*: traceme2 Set the description to: Verify that a signal emitted by a tracer to a child is caught by a signal handler. Sponsored by <The NetBSD Foundation> Merge code in tests: fork1 and vfork1 (ATF t_ptrace_wait*) Marge bodies of two tests into the same function. Add few checks for regular fork or not (vfork). Sponsored by <The NetBSD Foundation> ATF: ptrace: Merge code in fork2 and vfork2 tests with (v)fork1 ones Reduce code duplication, use the same function body with conditional switches. Sponsored by <The NetBSD Foundation> ATF t_ptrace_wait* refactoring: vforkdone1 and vforkdone2 Merge vforkdone1 and vforkdone2 into other fork tests and reuse the same function body fork_test(). There is an implicit enhancement in vforkdone2 that it was skipping PTRACE_VFORK check. This test is now marked as expected failure. PR kern/51630 Sponsored by <The NetBSD Foundation> Cover more fork/vfork/vforkdone scenarios in ATF ptrace(2) tests Use a shared common body for all the tests: fork1..fork8, vfork1..vfork8.= Merge vforkdone1 and vforkdone2 into vfork* tests. All the (v?)fork[1-8] tests cover: - calling either fork(2) or vfork(2) - tracking either enabled or disabled FORK, VFORK or VFORK_DONE All the PTRACE_VFORK tests are marked as expected failure. Sponsored by <The NetBSD Foundation> To generate a diff of this commit: cvs rdiff -u -r1.1 -r184.108.40.206 src/tests/lib/libc/sys/msg.h \ src/tests/lib/libc/sys/t_ptrace_wait.h cvs rdiff -u -r220.127.116.11 -r18.104.22.168 src/tests/lib/libc/sys/t_ptrace_wait.c cvs rdiff -u -r22.214.171.124 -r126.96.36.199 src/tests/lib/libc/sys/t_ptrace_x86_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.