Module Name:    src
Committed By:   martin
Date:           Tue Mar  6 09:52:09 UTC 2018

Modified Files:
        src/doc [netbsd-8]: CHANGES
        src/lib/libc/sys [netbsd-8]: ptrace.2
        src/sys/kern [netbsd-8]: sys_ptrace_common.c
        src/sys/sys [netbsd-8]: ptrace.h
        src/tests/lib/libc/sys [netbsd-8]: t_ptrace_wait.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #602):
        doc/CHANGES{,.prev}: revision 1.138
        sys/sys/ptrace.h: revision 1.63
        lib/libc/sys/ptrace.2: revision 1.68
        sys/kern/sys_ptrace_common.c: revision 1.35 (via patch)
        tests/lib/libc/sys/t_ptrace_wait.c: revision 1.23

Remove PT_GET_SIGMASK / PT_SET_SIGMASK

These operations cloned Linux's specific PTRACE_GETSIGMASK /
PTRACE_SETSIGMASK.

This feature was useful in applications like rr/criu/reptyr-like, where
the ptrace(2) interface is abused for the purpose of constructing an
arbitrary
process. It's not reliable and not portable. For the NetBSD case it will =
be
better to invent something dedicated for serializing and deserializing a
process with threads.

Noted on tech-toolchain@ and blog entry
"LLDB restoration and return to ptrace(2)"
https://blog.netbsd.org/tnf/entry/lldb_restoration_and_return_to


To generate a diff of this commit:
cvs rdiff -u -r1.2286.2.2 -r1.2286.2.3 src/doc/CHANGES
cvs rdiff -u -r1.67 -r1.67.2.1 src/lib/libc/sys/ptrace.2
cvs rdiff -u -r1.22 -r1.22.2.1 src/sys/kern/sys_ptrace_common.c
cvs rdiff -u -r1.60 -r1.60.6.1 src/sys/sys/ptrace.h
cvs rdiff -u -r1.9.2.1 -r1.9.2.2 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/doc/CHANGES
diff -u src/doc/CHANGES:1.2286.2.2 src/doc/CHANGES:1.2286.2.3
--- src/doc/CHANGES:1.2286.2.2	Wed Aug 30 15:45:05 2017
+++ src/doc/CHANGES	Tue Mar  6 09:52:09 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2286.2.2 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2286.2.3 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -355,6 +355,8 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	amd64: Use fine-grained permissions for architecture-specific memory
 		areas (W^X). [maxv 20160725]
 	sdtemp(4): Add support for Atmel AT30TS00, AT30TSE004, Giantec
+	kernel: SMBFS uses low-overhead NT Directory Change Notify SMB to watch
+		for vnode kqueue(2) events on directories [jdolecek 20030407]
 		GT30TS00, GT34TS02, Microchip MCP9804, MCP98244, IDT
 		TS3000GB[02], TS3001GB2, TSE200[24]GB2 and On Semiconductor
 		CAT34TS04. [msaitoh 20160726]

Index: src/lib/libc/sys/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.67 src/lib/libc/sys/ptrace.2:1.67.2.1
--- src/lib/libc/sys/ptrace.2:1.67	Sat Jun  3 19:41:14 2017
+++ src/lib/libc/sys/ptrace.2	Tue Mar  6 09:52:09 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ptrace.2,v 1.67 2017/06/03 19:41:14 abhinav Exp $
+.\"	$NetBSD: ptrace.2,v 1.67.2.1 2018/03/06 09:52:09 martin Exp $
 .\"
 .\" This file is in the public domain.
 .Dd April 7, 2017
@@ -561,31 +561,6 @@ The
 .Fa data
 argument should be set to
 .Li sizeof(struct ptrace_siginfo) .
-.It Dv PT_SET_SIGMASK
-This request loads the traced process' signal mask from
-.Dq Li "sigset_t"
-(defined in
-.In sys/sigtypes.h )
-pointed to by
-.Fa addr .
-The
-.Fa data
-argument contains the LWP ID of the thread whose registers are to
-be written.
-If zero is supplied, the first thread of the process is written.
-.It Dv PT_GET_SIGMASK
-This request is the converse of
-.Dv PT_SET_SIGMASK ;
-it reads the traced process' signal mask into
-.Dq Li "sigset_t"
-(defined in
-.In sys/sigtypes.h )
-pointed to by
-.Fa addr .
-The
-.Fa data
-argument contains the LWP ID of the thread whose mask is to be read.
-If zero is supplied, the first thread of the process is read.
 .It Dv PT_RESUME
 Allow execution of a specified thread,
 change its state from suspended to continued.

Index: src/sys/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.22 src/sys/kern/sys_ptrace_common.c:1.22.2.1
--- src/sys/kern/sys_ptrace_common.c:1.22	Wed May  3 15:53:31 2017
+++ src/sys/kern/sys_ptrace_common.c	Tue Mar  6 09:52:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.22 2017/05/03 15:53:31 kamil Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.22.2.1 2018/03/06 09:52:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.22 2017/05/03 15:53:31 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.22.2.1 2018/03/06 09:52:09 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -213,8 +213,6 @@ ptrace_listener_cb(kauth_cred_t cred, ka
 	case PT_GET_PROCESS_STATE:
 	case PT_SET_SIGINFO:
 	case PT_GET_SIGINFO:
-	case PT_SET_SIGMASK:
-	case PT_GET_SIGMASK:
 #ifdef __HAVE_PTRACE_MACHDEP
 	PTRACE_MACHDEP_REQUEST_CASES
 #endif
@@ -408,8 +406,6 @@ do_ptrace(struct ptrace_methods *ptm, st
 	case  PT_IO:
 	case  PT_SET_SIGINFO:
 	case  PT_GET_SIGINFO:
-	case  PT_SET_SIGMASK:
-	case  PT_GET_SIGMASK:
 #ifdef PT_GETREGS
 	case  PT_GETREGS:
 #endif
@@ -1120,36 +1116,6 @@ do_ptrace(struct ptrace_methods *ptm, st
 
 		break;
 
-	case  PT_SET_SIGMASK:
-		write = 1;
-
-	case  PT_GET_SIGMASK:
-		/* write = 0 done above. */
-
-		tmp = data;
-		if (tmp != 0 && t->p_nlwps > 1) {
-			lwp_delref(lt);
-			mutex_enter(t->p_lock);
-			lt = lwp_find(t, tmp);
-			if (lt == NULL) {
-				mutex_exit(t->p_lock);
-				error = ESRCH;
-				break;
-			}
-			lwp_addref(lt);
-			mutex_exit(t->p_lock);
-		}
-
-		if (lt->l_flag & LW_SYSTEM)
-			error = EINVAL;
-		else if (write == 1) {
-			error = copyin(addr, &lt->l_sigmask, sizeof(sigset_t));
-			sigminusset(&sigcantmask, &lt->l_sigmask);
-		} else
-			error = copyout(&lt->l_sigmask, addr, sizeof(sigset_t));
-			
-		break;
-
 	case  PT_RESUME:
 		write = 1;
 

Index: src/sys/sys/ptrace.h
diff -u src/sys/sys/ptrace.h:1.60 src/sys/sys/ptrace.h:1.60.6.1
--- src/sys/sys/ptrace.h:1.60	Fri Mar 24 17:40:44 2017
+++ src/sys/sys/ptrace.h	Tue Mar  6 09:52:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.60 2017/03/24 17:40:44 christos Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.60.6.1 2018/03/06 09:52:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 1984, 1993
@@ -55,10 +55,8 @@
 #define	PT_GET_PROCESS_STATE	18	/* get process state, defined below */
 #define	PT_SET_SIGINFO		19	/* set signal state, defined below */
 #define	PT_GET_SIGINFO		20	/* get signal state, defined below */
-#define	PT_SET_SIGMASK		21	/* set signal mask */
-#define	PT_GET_SIGMASK		22	/* get signal mask */
-#define	PT_RESUME		23	/* allow execution of the LWP */
-#define	PT_SUSPEND		24	/* prevent execution of the LWP */
+#define	PT_RESUME		21	/* allow execution of the LWP */
+#define	PT_SUSPEND		22	/* prevent execution of the LWP */
 
 #define	PT_FIRSTMACH		32	/* for machine-specific requests */
 #include <machine/ptrace.h>		/* machine-specific requests, if any */
@@ -85,10 +83,8 @@
 /* 18 */    "PT_GET_PROCESS_STATE", \
 /* 19 */    "PT_SET_SIGINFO", \
 /* 20 */    "PT_GET_SIGINFO", \
-/* 21 */    "PT_GET_SIGMASK", \
-/* 22 */    "PT_GET_SIGMASK", \
-/* 23 */    "PT_RESUME", \
-/* 24 */    "PT_SUSPEND",
+/* 21 */    "PT_RESUME", \
+/* 22 */    "PT_SUSPEND",
 
 /* PT_{G,S}EVENT_MASK */
 typedef struct ptrace_event {

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.9.2.1 src/tests/lib/libc/sys/t_ptrace_wait.c:1.9.2.2
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.9.2.1	Sun Feb 25 20:59:46 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Tue Mar  6 09:52:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.9.2.1 2018/02/25 20:59:46 snj Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.9.2.2 2018/03/06 09:52:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.9.2.1 2018/02/25 20:59:46 snj Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.9.2.2 2018/03/06 09:52:09 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -6555,492 +6555,6 @@ ATF_TC_BODY(signal10, tc)
 	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
 }
 
-ATF_TC(getsigmask1);
-ATF_TC_HEAD(getsigmask1, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	    "Verify that plain PT_SET_SIGMASK can be called");
-}
-
-ATF_TC_BODY(getsigmask1, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-	sigset_t mask;
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Before calling PT_GET_SIGMASK\n");
-	SYSCALL_REQUIRE(ptrace(PT_GET_SIGMASK, child, &mask, 0) != -1);
-
-	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\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_exited(status, exitval);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(getsigmask2);
-ATF_TC_HEAD(getsigmask2, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	    "Verify that PT_SET_SIGMASK reports correct mask from tracee");
-}
-
-ATF_TC_BODY(getsigmask2, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	const int sigmasked = SIGTRAP;
-	pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-	sigset_t mask;
-	sigset_t expected_mask;
-	ATF_REQUIRE(sigemptyset(&mask) == 0);
-	ATF_REQUIRE(sigemptyset(&expected_mask) == 0);
-	ATF_REQUIRE(sigaddset(&expected_mask, sigmasked) == 0);
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		sigaddset(&mask, sigmasked);
-		sigprocmask(SIG_BLOCK, &mask, NULL);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Before calling PT_GET_SIGMASK\n");
-	SYSCALL_REQUIRE(ptrace(PT_GET_SIGMASK, child, &mask, 0) != -1);
-
-	ATF_REQUIRE(memcmp(&mask, &expected_mask, sizeof(sigset_t)) == 0);
-
-	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\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_exited(status, exitval);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(setsigmask1);
-ATF_TC_HEAD(setsigmask1, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	    "Verify that plain PT_SET_SIGMASK can be called with empty mask");
-}
-
-ATF_TC_BODY(setsigmask1, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-	sigset_t mask;
-	ATF_REQUIRE(sigemptyset(&mask) == 0);
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Before calling PT_SET_SIGMASK for empty mask\n");
-	SYSCALL_REQUIRE(ptrace(PT_SET_SIGMASK, child, &mask, 0) != -1);
-
-	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\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_exited(status, exitval);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(setsigmask2);
-ATF_TC_HEAD(setsigmask2, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	    "Verify that sigmask is preserved between PT_GET_SIGMASK and "
-	    "PT_SET_SIGMASK");
-}
-
-ATF_TC_BODY(setsigmask2, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-	sigset_t new_mask;
-	sigset_t mask;
-	ATF_REQUIRE(sigemptyset(&new_mask) == 0);
-	ATF_REQUIRE(sigemptyset(&mask) == 0);
-	ATF_REQUIRE(sigaddset(&mask, SIGINT) == 0);
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Before calling PT_SET_SIGMASK for new mask with SIGINT\n");
-	SYSCALL_REQUIRE(ptrace(PT_SET_SIGMASK, child, &mask, 0) != -1);
-
-	DPRINTF("Before calling PT_GET_SIGMASK to store it in new_mask\n");
-	SYSCALL_REQUIRE(ptrace(PT_GET_SIGMASK, child, &new_mask, 0) != -1);
-
-	ATF_REQUIRE(memcmp(&mask, &new_mask, sizeof(sigset_t)) == 0);
-
-	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\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_exited(status, exitval);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(setsigmask3);
-ATF_TC_HEAD(setsigmask3, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	    "Verify that sigmask is preserved between PT_GET_SIGMASK, process "
-	    "resumed and PT_SET_SIGMASK");
-}
-
-ATF_TC_BODY(setsigmask3, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-	sigset_t new_mask;
-	sigset_t mask;
-	ATF_REQUIRE(sigemptyset(&new_mask) == 0);
-	ATF_REQUIRE(sigemptyset(&mask) == 0);
-	ATF_REQUIRE(sigaddset(&mask, SIGINT) == 0);
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Before calling PT_SET_SIGMASK for new mask with SIGINT\n");
-	SYSCALL_REQUIRE(ptrace(PT_SET_SIGMASK, child, &mask, 0) != -1);
-
-	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\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Before calling PT_GET_SIGMASK to store it in new_mask\n");
-	SYSCALL_REQUIRE(ptrace(PT_GET_SIGMASK, child, &new_mask, 0) != -1);
-
-	ATF_REQUIRE(memcmp(&mask, &new_mask, sizeof(sigset_t)) == 0);
-
-	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\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_exited(status, exitval);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(setsigmask4);
-ATF_TC_HEAD(setsigmask4, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	    "Verify that new sigmask is visible in tracee");
-}
-
-ATF_TC_BODY(setsigmask4, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-	sigset_t mask;
-	sigset_t expected_mask;
-	ATF_REQUIRE(sigemptyset(&mask) == 0);
-	ATF_REQUIRE(sigemptyset(&expected_mask) == 0);
-	ATF_REQUIRE(sigaddset(&expected_mask, SIGINT) == 0);
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		sigprocmask(0, NULL, &mask);
-
-		FORKEE_ASSERT
-		    (memcmp(&mask, &expected_mask, sizeof(sigset_t)) == 0);
-
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Before calling PT_SET_SIGMASK for new mask with SIGINT\n");
-	SYSCALL_REQUIRE(ptrace(PT_SET_SIGMASK, child, &expected_mask, 0) != -1);
-
-	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\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_exited(status, exitval);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(setsigmask5);
-ATF_TC_HEAD(setsigmask5, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	    "Verify that sigmask cannot be set to SIGKILL");
-}
-
-ATF_TC_BODY(setsigmask5, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-	sigset_t new_mask;
-	sigset_t mask;
-	ATF_REQUIRE(sigemptyset(&new_mask) == 0);
-	ATF_REQUIRE(sigemptyset(&mask) == 0);
-	ATF_REQUIRE(sigaddset(&mask, SIGKILL) == 0);
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Before calling PT_SET_SIGMASK for new mask with SIGINT\n");
-	SYSCALL_REQUIRE(ptrace(PT_SET_SIGMASK, child, &mask, 0) != -1);
-
-	DPRINTF("Before calling PT_GET_SIGMASK to store it in new_mask\n");
-	SYSCALL_REQUIRE(ptrace(PT_GET_SIGMASK, child, &new_mask, 0) != -1);
-
-	ATF_REQUIRE(memcmp(&mask, &new_mask, sizeof(sigset_t)) != 0);
-
-	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\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_exited(status, exitval);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(setsigmask6);
-ATF_TC_HEAD(setsigmask6, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	    "Verify that sigmask cannot be set to SIGSTOP");
-}
-
-ATF_TC_BODY(setsigmask6, tc)
-{
-	const int exitval = 5;
-	const int sigval = SIGSTOP;
-	pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
-	int status;
-#endif
-	sigset_t new_mask;
-	sigset_t mask;
-	ATF_REQUIRE(sigemptyset(&new_mask) == 0);
-	ATF_REQUIRE(sigemptyset(&mask) == 0);
-	ATF_REQUIRE(sigaddset(&mask, SIGSTOP) == 0);
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		DPRINTF("Before raising %s from child\n", strsignal(sigval));
-		FORKEE_ASSERT(raise(sigval) == 0);
-
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_stopped(status, sigval);
-
-	DPRINTF("Before calling PT_SET_SIGMASK for new mask with SIGINT\n");
-	SYSCALL_REQUIRE(ptrace(PT_SET_SIGMASK, child, &mask, 0) != -1);
-
-	DPRINTF("Before calling PT_GET_SIGMASK to store it in new_mask\n");
-	SYSCALL_REQUIRE(ptrace(PT_GET_SIGMASK, child, &new_mask, 0) != -1);
-
-	ATF_REQUIRE(memcmp(&mask, &new_mask, sizeof(sigset_t)) != 0);
-
-	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\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
-	validate_status_exited(status, exitval);
-
-	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
 static void
 lwp_main_stop(void *arg)
 {
@@ -7681,16 +7195,6 @@ ATF_TP_ADD_TCS(tp)
 
 	ATF_TP_ADD_TC(tp, resume1);
 
-	ATF_TP_ADD_TC(tp, getsigmask1);
-	ATF_TP_ADD_TC(tp, getsigmask2);
-
-	ATF_TP_ADD_TC(tp, setsigmask1);
-	ATF_TP_ADD_TC(tp, setsigmask2);
-	ATF_TP_ADD_TC(tp, setsigmask3);
-	ATF_TP_ADD_TC(tp, setsigmask4);
-	ATF_TP_ADD_TC(tp, setsigmask5);
-	ATF_TP_ADD_TC(tp, setsigmask6);
-
 	ATF_TP_ADD_TC(tp, syscall1);
 
 	ATF_TP_ADD_TC(tp, syscallemu1);

Reply via email to