Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/tests/lib/libc/sys Apply patch, requested by kamil in tic...



details:   https://anonhg.NetBSD.org/src/rev/e4809709cd83
branches:  netbsd-9
changeset: 963909:e4809709cd83
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 25 17:06:52 2020 +0000

description:
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

diffstat:

 tests/lib/libc/sys/t_ptrace_wait.c |  30 ++++++++----------------------
 1 files changed, 8 insertions(+), 22 deletions(-)

diffs (79 lines):

diff -r cedde4218c29 -r e4809709cd83 tests/lib/libc/sys/t_ptrace_wait.c
--- a/tests/lib/libc/sys/t_ptrace_wait.c        Mon May 25 17:00:20 2020 +0000
+++ b/tests/lib/libc/sys/t_ptrace_wait.c        Mon May 25 17:06:52 2020 +0000
@@ -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 @@
                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 @@
        }
 #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 @@
                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 @@
                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 @@
                    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);



Home | Main Index | Thread Index | Old Index