Module Name: src
Committed By: martin
Date: Mon May 25 17:06:52 UTC 2020
Modified Files:
src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c
Log Message:
Apply patch, requested by kamil in ticket #925:
Adaption of:
tests/lib/libc/sys/t_ptrace_fork_wait.h 1.3,1.4,1.6
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
To generate a diff of this commit:
cvs rdiff -u -r1.131.2.7 -r1.131.2.8 src/tests/lib/libc/sys/t_ptrace_wait.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.7 src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.8
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.7 Mon May 25 17:00:20 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c Mon May 25 17:06:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace_wait.c,v 1.131.2.7 2020/05/25 17:00:20 martin Exp $ */
+/* $NetBSD: t_ptrace_wait.c,v 1.131.2.8 2020/05/25 17:06:52 martin Exp $ */
/*-
* Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.7 2020/05/25 17:00:20 martin Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.8 2020/05/25 17:06:52 martin Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -3041,6 +3041,8 @@ fork_body(const char *fn, bool trackspaw
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 trackspaw
}
#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,
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,
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,
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);