commit ce01c5f06ddf55b62f640e906d03d8429bd5334a Author: Kamil Rytarowski Date: Sat May 23 01:39:30 2020 +0200 Commit message ============== Ignore interception of SIGCHLD signals in the debugger There is a race that SIGCHLD might be blocked during forking and dropped. PR/55241 by Andreas Gustafsson ---------------------------- This implements differently commits from HEAD: commit aea244f3512e47e99d4337ecb782953089f2308a Author: kamil Date: Sat May 16 23:10:26 2020 +0000 Ignore interception of SIGCHLD signals in the debugger Set SIGPASS for SIGCHLD for the traced child in the following tests: - unrelated_tracer_fork* - unrelated_tracer_vfork* - unrelated_tracer_posix_spawn* There is a race that SIGCHLD might be blocked during forking and dropped. PR/55241 by Andreas Gustafsson ---------------------------------------- commit 34cfb0c1db5efa1849ea8411ec69ec78f7c04b2d Author: kamil Date: Sat May 16 19:08:20 2020 +0000 Ignore interception of SIGCHLD signals in the debugger Set SIGPASS for SIGCHLD for the traced child in the following tests: - posix_spawn_singalmasked - posix_spawn_singalignored - fork_singalmasked - fork_singalignored - vfork_singalmasked - vfork_singalignored - vforkdone_singalmasked - vforkdone_singalignored There is a race that SIGCHLD might be blocked during forking and dropped. PR/55241 by Andreas Gustafsson ------------------------------------------ commit cc0420c934816d052dad27957ea7e047881c2bb1 Author: kamil Date: Thu May 14 19:21:35 2020 +0000 Ignore interception of the SIGCHLD signals. SIGCHLD once blocked is discarded by the kernel as it has the SA_IGNORE property. During the fork(2) operation all signals can be shortly blocked and missed (unless there is a registered signal handler in the traced child). This leads to a race in this test if there would be an intention to catch SIGCHLD. Fixes PR lib/55241 by Andreas Gustafsson --------------------------- diff --git a/tests/lib/libc/sys/t_ptrace_wait.c b/tests/lib/libc/sys/t_ptrace_wait.c index 44ea33a51111..848b071bf982 100644 --- a/tests/lib/libc/sys/t_ptrace_wait.c +++ b/tests/lib/libc/sys/t_ptrace_wait.c @@ -3041,6 +3041,8 @@ fork_body(const char *fn, bool trackspawn, bool trackfork, bool trackvfork, DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + sigblock(sigmask(SIGCHLD)); + DPRINTF("Before raising %s from child\n", strsignal(sigval)); FORKEE_ASSERT(raise(sigval) == 0); @@ -3197,16 +3199,6 @@ fork_body(const char *fn, bool trackspawn, bool trackfork, bool trackvfork, } #endif - DPRINTF("Before calling %s() for the child - expected stopped " - "SIGCHLD\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, SIGCHLD); - - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); - DPRINTF("Before calling %s() for the child - expected exited\n", TWAIT_FNAME); TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); @@ -3333,6 +3325,8 @@ fork_detach_forker_body(const char *fn, bool kill_process) DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + sigblock(sigmask(SIGCHLD)); + DPRINTF("Before raising %s from child\n", strsignal(sigval)); FORKEE_ASSERT(raise(sigval) == 0); @@ -5763,6 +5757,8 @@ fork2_body(const char *fn, bool masked, bool ignored) DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + sigblock(sigmask(SIGCHLD)); + if (masked) { sigemptyset(&intmask); sigaddset(&intmask, SIGTRAP); @@ -6062,16 +6058,6 @@ fork2_body(const char *fn, bool masked, bool ignored) wpid = TWAIT_GENERIC(child2, &status, 0)); } - DPRINTF("Before calling %s() for the child - expected stopped " - "SIGCHLD\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, SIGCHLD); - - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); - DPRINTF("Before calling %s() for the child - expected exited\n", TWAIT_FNAME); TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);