summaryrefslogtreecommitdiff
path: root/tests/kernel
diff options
context:
space:
mode:
authorkamil <kamil@NetBSD.org>2017-04-02 01:49:51 +0000
committerkamil <kamil@NetBSD.org>2017-04-02 01:49:51 +0000
commitcae48e6016810408e681bb56ea121ebb52a069a8 (patch)
tree67db86f447180332bfbc023561b1bca5e1b1ddec /tests/kernel
parent72aa1f0d169920aa3f9860975237e8aba927f2f3 (diff)
Remove kernel/arch/{amd64,i386,x86} tests
These files were merged with kernel/t_ptrace_wait* This removes MD test files. Sponsored by <The NetBSD Foundation>
Diffstat (limited to 'tests/kernel')
-rw-r--r--tests/kernel/Makefile3
-rw-r--r--tests/kernel/arch/Makefile21
-rw-r--r--tests/kernel/arch/Makefile.inc1
-rw-r--r--tests/kernel/arch/amd64/Makefile18
-rw-r--r--tests/kernel/arch/amd64/Makefile.inc1
-rw-r--r--tests/kernel/arch/amd64/t_ptrace_wait.c149
-rw-r--r--tests/kernel/arch/amd64/t_ptrace_wait3.c30
-rw-r--r--tests/kernel/arch/amd64/t_ptrace_wait4.c30
-rw-r--r--tests/kernel/arch/amd64/t_ptrace_wait6.c30
-rw-r--r--tests/kernel/arch/amd64/t_ptrace_waitid.c30
-rw-r--r--tests/kernel/arch/amd64/t_ptrace_waitpid.c30
-rw-r--r--tests/kernel/arch/i386/Makefile18
-rw-r--r--tests/kernel/arch/i386/Makefile.inc1
-rw-r--r--tests/kernel/arch/i386/t_ptrace_wait.c141
-rw-r--r--tests/kernel/arch/i386/t_ptrace_wait3.c30
-rw-r--r--tests/kernel/arch/i386/t_ptrace_wait4.c30
-rw-r--r--tests/kernel/arch/i386/t_ptrace_wait6.c30
-rw-r--r--tests/kernel/arch/i386/t_ptrace_waitid.c30
-rw-r--r--tests/kernel/arch/i386/t_ptrace_waitpid.c30
-rw-r--r--tests/kernel/arch/x86/Makefile18
-rw-r--r--tests/kernel/arch/x86/Makefile.inc1
-rw-r--r--tests/kernel/arch/x86/t_ptrace_wait.c2031
-rw-r--r--tests/kernel/arch/x86/t_ptrace_wait3.c30
-rw-r--r--tests/kernel/arch/x86/t_ptrace_wait4.c30
-rw-r--r--tests/kernel/arch/x86/t_ptrace_wait6.c30
-rw-r--r--tests/kernel/arch/x86/t_ptrace_waitid.c30
-rw-r--r--tests/kernel/arch/x86/t_ptrace_waitpid.c30
27 files changed, 1 insertions, 2852 deletions
diff --git a/tests/kernel/Makefile b/tests/kernel/Makefile
index be79f161511..369293d25fb 100644
--- a/tests/kernel/Makefile
+++ b/tests/kernel/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.44 2016/12/14 06:19:59 kamil Exp $
+# $NetBSD: Makefile,v 1.45 2017/04/02 01:49:52 kamil Exp $
NOMAN= # defined
@@ -6,7 +6,6 @@ NOMAN= # defined
TESTSDIR= ${TESTSBASE}/kernel
-TESTS_SUBDIRS= arch
TESTS_SUBDIRS+= kqueue
TESTS_C= t_lock
TESTS_C+= t_lockf
diff --git a/tests/kernel/arch/Makefile b/tests/kernel/arch/Makefile
deleted file mode 100644
index 04dbd72b3f0..00000000000
--- a/tests/kernel/arch/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# $NetBSD: Makefile,v 1.3 2017/02/22 01:07:13 kamil Exp $
-
-NOMAN= # defined
-
-.include <bsd.own.mk>
-
-TESTSDIR= ${TESTSBASE}/kernel/arch
-
-.if (${MACHINE} == "amd64")
-TESTS_SUBDIRS+= amd64
-.endif
-
-.if (${MACHINE} == "i386")
-TESTS_SUBDIRS+= i386
-.endif
-
-.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
-TESTS_SUBDIRS+= x86
-.endif
-
-.include <bsd.test.mk>
diff --git a/tests/kernel/arch/Makefile.inc b/tests/kernel/arch/Makefile.inc
deleted file mode 100644
index 01b5f23410c..00000000000
--- a/tests/kernel/arch/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-.include "../Makefile.inc"
diff --git a/tests/kernel/arch/amd64/Makefile b/tests/kernel/arch/amd64/Makefile
deleted file mode 100644
index ab641fff1bf..00000000000
--- a/tests/kernel/arch/amd64/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# $NetBSD: Makefile,v 1.2 2016/12/13 12:59:46 kamil Exp $
-
-NOMAN= # defined
-
-.include <bsd.own.mk>
-
-TESTSDIR= ${TESTSBASE}/kernel/arch/amd64
-
-TESTS_C+= t_ptrace_wait
-TESTS_C+= t_ptrace_wait3
-TESTS_C+= t_ptrace_wait4
-TESTS_C+= t_ptrace_wait6
-TESTS_C+= t_ptrace_waitid
-TESTS_C+= t_ptrace_waitpid
-
-CPPFLAGS+= -D_KERNTYPES
-
-.include <bsd.test.mk>
diff --git a/tests/kernel/arch/amd64/Makefile.inc b/tests/kernel/arch/amd64/Makefile.inc
deleted file mode 100644
index 01b5f23410c..00000000000
--- a/tests/kernel/arch/amd64/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-.include "../Makefile.inc"
diff --git a/tests/kernel/arch/amd64/t_ptrace_wait.c b/tests/kernel/arch/amd64/t_ptrace_wait.c
deleted file mode 100644
index b48734c5d05..00000000000
--- a/tests/kernel/arch/amd64/t_ptrace_wait.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* $NetBSD: t_ptrace_wait.c,v 1.25 2017/02/22 01:07:13 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.25 2017/02/22 01:07:13 kamil Exp $");
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <sys/wait.h>
-#include <machine/reg.h>
-#include <err.h>
-#include <errno.h>
-#include <lwp.h>
-#include <sched.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <unistd.h>
-
-#include <atf-c.h>
-
-#include "../../../h_macros.h"
-
-#include "../../t_ptrace_wait.h"
-
-
-#if defined(HAVE_GPREGS)
-ATF_TC(regs1);
-ATF_TC_HEAD(regs1, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Call PT_GETREGS and iterate over General Purpose registers");
-}
-
-ATF_TC_BODY(regs1, tc)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- struct reg r;
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETREGS for the child process\n");
- ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
-
- printf("RAX=%#" PRIxREGISTER "\n", r.regs[_REG_RAX]);
- printf("RBX=%#" PRIxREGISTER "\n", r.regs[_REG_RBX]);
- printf("RCX=%#" PRIxREGISTER "\n", r.regs[_REG_RCX]);
- printf("RDX=%#" PRIxREGISTER "\n", r.regs[_REG_RDX]);
-
- printf("RDI=%#" PRIxREGISTER "\n", r.regs[_REG_RDI]);
- printf("RSI=%#" PRIxREGISTER "\n", r.regs[_REG_RSI]);
-
- printf("GS=%#" PRIxREGISTER "\n", r.regs[_REG_GS]);
- printf("FS=%#" PRIxREGISTER "\n", r.regs[_REG_FS]);
- printf("ES=%#" PRIxREGISTER "\n", r.regs[_REG_ES]);
- printf("DS=%#" PRIxREGISTER "\n", r.regs[_REG_DS]);
- printf("CS=%#" PRIxREGISTER "\n", r.regs[_REG_CS]);
- printf("SS=%#" PRIxREGISTER "\n", r.regs[_REG_SS]);
-
- printf("RSP=%#" PRIxREGISTER "\n", r.regs[_REG_RSP]);
- printf("RIP=%#" PRIxREGISTER "\n", r.regs[_REG_RIP]);
-
- printf("RFLAGS=%#" PRIxREGISTER "\n", r.regs[_REG_RFLAGS]);
-
- printf("R8=%#" PRIxREGISTER "\n", r.regs[_REG_R8]);
- printf("R9=%#" PRIxREGISTER "\n", r.regs[_REG_R9]);
- printf("R10=%#" PRIxREGISTER "\n", r.regs[_REG_R10]);
- printf("R11=%#" PRIxREGISTER "\n", r.regs[_REG_R11]);
- printf("R12=%#" PRIxREGISTER "\n", r.regs[_REG_R12]);
- printf("R13=%#" PRIxREGISTER "\n", r.regs[_REG_R13]);
- printf("R14=%#" PRIxREGISTER "\n", r.regs[_REG_R14]);
- printf("R15=%#" PRIxREGISTER "\n", r.regs[_REG_R15]);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-#endif
-
-ATF_TP_ADD_TCS(tp)
-{
- setvbuf(stdout, NULL, _IONBF, 0);
- setvbuf(stderr, NULL, _IONBF, 0);
-
- ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1);
-
- return atf_no_error();
-}
diff --git a/tests/kernel/arch/amd64/t_ptrace_wait3.c b/tests/kernel/arch/amd64/t_ptrace_wait3.c
deleted file mode 100644
index c5dfe735873..00000000000
--- a/tests/kernel/arch/amd64/t_ptrace_wait3.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAIT3
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/amd64/t_ptrace_wait4.c b/tests/kernel/arch/amd64/t_ptrace_wait4.c
deleted file mode 100644
index 7e1fed95ee6..00000000000
--- a/tests/kernel/arch/amd64/t_ptrace_wait4.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAIT4
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/amd64/t_ptrace_wait6.c b/tests/kernel/arch/amd64/t_ptrace_wait6.c
deleted file mode 100644
index 601efe3f3d6..00000000000
--- a/tests/kernel/arch/amd64/t_ptrace_wait6.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAIT6
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/amd64/t_ptrace_waitid.c b/tests/kernel/arch/amd64/t_ptrace_waitid.c
deleted file mode 100644
index 5ec17a9b8d2..00000000000
--- a/tests/kernel/arch/amd64/t_ptrace_waitid.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAITID
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/amd64/t_ptrace_waitpid.c b/tests/kernel/arch/amd64/t_ptrace_waitpid.c
deleted file mode 100644
index 78b341c111f..00000000000
--- a/tests/kernel/arch/amd64/t_ptrace_waitpid.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAITPID
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/i386/Makefile b/tests/kernel/arch/i386/Makefile
deleted file mode 100644
index 5210b51784e..00000000000
--- a/tests/kernel/arch/i386/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# $NetBSD: Makefile,v 1.1 2016/12/13 18:00:10 kamil Exp $
-
-NOMAN= # defined
-
-.include <bsd.own.mk>
-
-TESTSDIR= ${TESTSBASE}/kernel/arch/i386
-
-TESTS_C+= t_ptrace_wait
-TESTS_C+= t_ptrace_wait3
-TESTS_C+= t_ptrace_wait4
-TESTS_C+= t_ptrace_wait6
-TESTS_C+= t_ptrace_waitid
-TESTS_C+= t_ptrace_waitpid
-
-CPPFLAGS+= -D_KERNTYPES
-
-.include <bsd.test.mk>
diff --git a/tests/kernel/arch/i386/Makefile.inc b/tests/kernel/arch/i386/Makefile.inc
deleted file mode 100644
index 01b5f23410c..00000000000
--- a/tests/kernel/arch/i386/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-.include "../Makefile.inc"
diff --git a/tests/kernel/arch/i386/t_ptrace_wait.c b/tests/kernel/arch/i386/t_ptrace_wait.c
deleted file mode 100644
index 698573bb098..00000000000
--- a/tests/kernel/arch/i386/t_ptrace_wait.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $NetBSD: t_ptrace_wait.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <sys/wait.h>
-#include <machine/reg.h>
-#include <err.h>
-#include <errno.h>
-#include <sched.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <unistd.h>
-
-#include <atf-c.h>
-
-#include "h_macros.h"
-
-#include "../../t_ptrace_wait.h"
-
-
-#if defined(HAVE_GPREGS)
-ATF_TC(regs1);
-ATF_TC_HEAD(regs1, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Call PT_GETREGS and iterate over General Purpose registers");
-}
-
-ATF_TC_BODY(regs1, tc)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- struct reg r;
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETREGS for the child process\n");
- ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
-
- printf("EAX=%#" PRIxREGISTER "\n", r.r_eax);
- printf("EBX=%#" PRIxREGISTER "\n", r.r_ebx);
- printf("ECX=%#" PRIxREGISTER "\n", r.r_ecx);
- printf("EDX=%#" PRIxREGISTER "\n", r.r_edx);
-
- printf("ESP=%#" PRIxREGISTER "\n", r.r_esp);
- printf("EBP=%#" PRIxREGISTER "\n", r.r_ebp);
-
- printf("ESI=%#" PRIxREGISTER "\n", r.r_esi);
- printf("EDI=%#" PRIxREGISTER "\n", r.r_edi);
-
- printf("EIP=%#" PRIxREGISTER "\n", r.r_eip);
-
- printf("EFLAGS=%#" PRIxREGISTER "\n", r.r_eflags);
-
- printf("CS=%#" PRIxREGISTER "\n", r.r_cs);
- printf("SS=%#" PRIxREGISTER "\n", r.r_ss);
- printf("DS=%#" PRIxREGISTER "\n", r.r_ds);
- printf("ES=%#" PRIxREGISTER "\n", r.r_es);
- printf("FS=%#" PRIxREGISTER "\n", r.r_fs);
- printf("GS=%#" PRIxREGISTER "\n", r.r_gs);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-#endif
-
-ATF_TP_ADD_TCS(tp)
-{
- setvbuf(stdout, NULL, _IONBF, 0);
- setvbuf(stderr, NULL, _IONBF, 0);
-
- ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1);
-
- return atf_no_error();
-}
diff --git a/tests/kernel/arch/i386/t_ptrace_wait3.c b/tests/kernel/arch/i386/t_ptrace_wait3.c
deleted file mode 100644
index 56dda8e6978..00000000000
--- a/tests/kernel/arch/i386/t_ptrace_wait3.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAIT3
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/i386/t_ptrace_wait4.c b/tests/kernel/arch/i386/t_ptrace_wait4.c
deleted file mode 100644
index 5fbdb53503b..00000000000
--- a/tests/kernel/arch/i386/t_ptrace_wait4.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAIT4
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/i386/t_ptrace_wait6.c b/tests/kernel/arch/i386/t_ptrace_wait6.c
deleted file mode 100644
index 117c844123c..00000000000
--- a/tests/kernel/arch/i386/t_ptrace_wait6.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAIT6
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/i386/t_ptrace_waitid.c b/tests/kernel/arch/i386/t_ptrace_waitid.c
deleted file mode 100644
index 274e8bd9f19..00000000000
--- a/tests/kernel/arch/i386/t_ptrace_waitid.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAITID
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/i386/t_ptrace_waitpid.c b/tests/kernel/arch/i386/t_ptrace_waitpid.c
deleted file mode 100644
index 2fe5c570f9f..00000000000
--- a/tests/kernel/arch/i386/t_ptrace_waitpid.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAITPID
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/x86/Makefile b/tests/kernel/arch/x86/Makefile
deleted file mode 100644
index a65e295201c..00000000000
--- a/tests/kernel/arch/x86/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# $NetBSD: Makefile,v 1.1 2017/02/22 01:07:13 kamil Exp $
-
-NOMAN= # defined
-
-.include <bsd.own.mk>
-
-TESTSDIR= ${TESTSBASE}/kernel/arch/x86
-
-TESTS_C+= t_ptrace_wait
-TESTS_C+= t_ptrace_wait3
-TESTS_C+= t_ptrace_wait4
-TESTS_C+= t_ptrace_wait6
-TESTS_C+= t_ptrace_waitid
-TESTS_C+= t_ptrace_waitpid
-
-CPPFLAGS+= -D_KERNTYPES
-
-.include <bsd.test.mk>
diff --git a/tests/kernel/arch/x86/Makefile.inc b/tests/kernel/arch/x86/Makefile.inc
deleted file mode 100644
index 01b5f23410c..00000000000
--- a/tests/kernel/arch/x86/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-.include "../Makefile.inc"
diff --git a/tests/kernel/arch/x86/t_ptrace_wait.c b/tests/kernel/arch/x86/t_ptrace_wait.c
deleted file mode 100644
index db5272f69a0..00000000000
--- a/tests/kernel/arch/x86/t_ptrace_wait.c
+++ /dev/null
@@ -1,2031 +0,0 @@
-/* $NetBSD: t_ptrace_wait.c,v 1.8 2017/04/01 23:28:02 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.8 2017/04/01 23:28:02 kamil Exp $");
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <sys/wait.h>
-#include <machine/reg.h>
-#include <err.h>
-#include <errno.h>
-#include <lwp.h>
-#include <sched.h>
-#include <signal.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <unistd.h>
-
-#include <atf-c.h>
-
-#include "../../../h_macros.h"
-
-#include "../../t_ptrace_wait.h"
-
-
-union u {
- unsigned long raw;
- struct {
- unsigned long local_dr0_breakpoint : 1; /* 0 */
- unsigned long global_dr0_breakpoint : 1; /* 1 */
- unsigned long local_dr1_breakpoint : 1; /* 2 */
- unsigned long global_dr1_breakpoint : 1; /* 3 */
- unsigned long local_dr2_breakpoint : 1; /* 4 */
- unsigned long global_dr2_breakpoint : 1; /* 5 */
- unsigned long local_dr3_breakpoint : 1; /* 6 */
- unsigned long global_dr3_breakpoint : 1; /* 7 */
- unsigned long local_exact_breakpt : 1; /* 8 */
- unsigned long global_exact_breakpt : 1; /* 9 */
- unsigned long reserved_10 : 1; /* 10 */
- unsigned long rest_trans_memory : 1; /* 11 */
- unsigned long reserved_12 : 1; /* 12 */
- unsigned long general_detect_enable : 1; /* 13 */
- unsigned long reserved_14 : 1; /* 14 */
- unsigned long reserved_15 : 1; /* 15 */
- unsigned long condition_dr0 : 2; /* 16-17 */
- unsigned long len_dr0 : 2; /* 18-19 */
- unsigned long condition_dr1 : 2; /* 20-21 */
- unsigned long len_dr1 : 2; /* 22-23 */
- unsigned long condition_dr2 : 2; /* 24-25 */
- unsigned long len_dr2 : 2; /* 26-27 */
- unsigned long condition_dr3 : 2; /* 28-29 */
- unsigned long len_dr3 : 2; /* 30-31 */
- } bits;
-};
-
-ATF_TC(dbregs_print);
-ATF_TC_HEAD(dbregs_print, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify plain PT_GETDBREGS with printing Debug Registers");
-}
-
-ATF_TC_BODY(dbregs_print, tc)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- struct dbreg r;
- size_t i;
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETDBREGS for the child process\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r, 0) != -1);
-
- printf("State of the debug registers:\n");
- for (i = 0; i < __arraycount(r.dr); i++)
- printf("r[%zu]=%" PRIxREGISTER "\n", i, r.dr[i]);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-
-enum dbreg_preserve_mode {
- dbreg_preserve_mode_none,
- dbreg_preserve_mode_yield,
- dbreg_preserve_mode_continued
-};
-
-static void
-dbreg_preserve(int reg, enum dbreg_preserve_mode mode)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- struct dbreg r1;
- struct dbreg r2;
- size_t i;
- int watchme;
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- if (mode == dbreg_preserve_mode_continued) {
- printf("Before raising %s from child\n",
- strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
- }
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
-
- printf("State of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- r1.dr[reg] = (long)(intptr_t)&watchme;
- printf("Set DR0 (r1.dr[%d]) to new value %" PRIxREGISTER "\n",
- reg, r1.dr[reg]);
-
- printf("New state of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- switch (mode) {
- case dbreg_preserve_mode_none:
- break;
- case dbreg_preserve_mode_yield:
- printf("Yields a processor voluntarily and gives other "
- "threads a chance to run without waiting for an "
- "involuntary preemptive switch\n");
- sched_yield();
- break;
- case dbreg_preserve_mode_continued:
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
- break;
- }
-
- printf("Call GETDBREGS for the child process (r2)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r2, 0) != -1);
-
- printf("Assert that (r1) and (r2) are the same\n");
- ATF_REQUIRE(memcmp(&r1, &r2, sizeof(r1)) == 0);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-
-ATF_TC(dbregs_preserve_dr0);
-ATF_TC_HEAD(dbregs_preserve_dr0, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR0 is preserved across ptrace(2) calls");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr0, tc)
-{
- dbreg_preserve(0, dbreg_preserve_mode_none);
-}
-
-ATF_TC(dbregs_preserve_dr1);
-ATF_TC_HEAD(dbregs_preserve_dr1, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR1 is preserved across ptrace(2) calls");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr1, tc)
-{
- dbreg_preserve(1, dbreg_preserve_mode_none);
-}
-
-ATF_TC(dbregs_preserve_dr2);
-ATF_TC_HEAD(dbregs_preserve_dr2, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR2 is preserved across ptrace(2) calls");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr2, tc)
-{
- dbreg_preserve(2, dbreg_preserve_mode_none);
-}
-
-ATF_TC(dbregs_preserve_dr3);
-ATF_TC_HEAD(dbregs_preserve_dr3, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR3 is preserved across ptrace(2) calls");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr3, tc)
-{
- dbreg_preserve(3, dbreg_preserve_mode_none);
-}
-
-ATF_TC(dbregs_preserve_dr0_yield);
-ATF_TC_HEAD(dbregs_preserve_dr0_yield, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR0 is preserved across ptrace(2) calls with "
- "scheduler yield");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr0_yield, tc)
-{
- dbreg_preserve(0, dbreg_preserve_mode_yield);
-}
-
-ATF_TC(dbregs_preserve_dr1_yield);
-ATF_TC_HEAD(dbregs_preserve_dr1_yield, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR1 is preserved across ptrace(2) calls with "
- "scheduler yield");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr1_yield, tc)
-{
- dbreg_preserve(0, dbreg_preserve_mode_yield);
-}
-
-ATF_TC(dbregs_preserve_dr2_yield);
-ATF_TC_HEAD(dbregs_preserve_dr2_yield, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR2 is preserved across ptrace(2) calls with "
- "scheduler yield");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr2_yield, tc)
-{
- dbreg_preserve(0, dbreg_preserve_mode_yield);
-}
-
-
-ATF_TC(dbregs_preserve_dr3_yield);
-ATF_TC_HEAD(dbregs_preserve_dr3_yield, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR3 is preserved across ptrace(2) calls with "
- "scheduler yield");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr3_yield, tc)
-{
- dbreg_preserve(3, dbreg_preserve_mode_yield);
-}
-
-ATF_TC(dbregs_preserve_dr0_continued);
-ATF_TC_HEAD(dbregs_preserve_dr0_continued, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR0 is preserved across ptrace(2) calls and "
- "with continued child");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr0_continued, tc)
-{
- dbreg_preserve(0, dbreg_preserve_mode_continued);
-}
-
-ATF_TC(dbregs_preserve_dr1_continued);
-ATF_TC_HEAD(dbregs_preserve_dr1_continued, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR1 is preserved across ptrace(2) calls and "
- "with continued child");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr1_continued, tc)
-{
- dbreg_preserve(1, dbreg_preserve_mode_continued);
-}
-
-ATF_TC(dbregs_preserve_dr2_continued);
-ATF_TC_HEAD(dbregs_preserve_dr2_continued, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR2 is preserved across ptrace(2) calls and "
- "with continued child");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr2_continued, tc)
-{
- dbreg_preserve(2, dbreg_preserve_mode_continued);
-}
-
-ATF_TC(dbregs_preserve_dr3_continued);
-ATF_TC_HEAD(dbregs_preserve_dr3_continued, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting DR3 is preserved across ptrace(2) calls and "
- "with continued child");
-}
-
-ATF_TC_BODY(dbregs_preserve_dr3_continued, tc)
-{
- dbreg_preserve(3, dbreg_preserve_mode_continued);
-}
-
-
-static void
-dbregs_trap_variable(int reg, int cond, int len, bool write)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- struct dbreg r1;
- size_t i;
- volatile int watchme = 0;
- union u dr7;
-
- struct ptrace_siginfo info;
- memset(&info, 0, sizeof(info));
-
- dr7.raw = 0;
- switch (reg) {
- case 0:
- dr7.bits.global_dr0_breakpoint = 1;
- dr7.bits.condition_dr0 = cond;
- dr7.bits.len_dr0 = len;
- case 1:
- dr7.bits.global_dr1_breakpoint = 1;
- dr7.bits.condition_dr1 = cond;
- dr7.bits.len_dr1 = len;
- case 2:
- dr7.bits.global_dr2_breakpoint = 1;
- dr7.bits.condition_dr2 = cond;
- dr7.bits.len_dr2 = len;
- case 3:
- dr7.bits.global_dr3_breakpoint = 1;
- dr7.bits.condition_dr3 = cond;
- dr7.bits.len_dr3 = len;
- break;
- }
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- if (write)
- watchme = 1;
- else
- printf("watchme=%d\n", watchme);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
-
- printf("State of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- r1.dr[reg] = (long)(intptr_t)&watchme;
- printf("Set DR%d (r1.dr[%d]) to new value %" PRIxREGISTER "\n",
- reg, reg, r1.dr[reg]);
-
- r1.dr[7] = dr7.raw;
- printf("Set DR7 (r1.dr[7]) to new value %" PRIxREGISTER "\n",
- r1.dr[7]);
-
- printf("New state of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, SIGTRAP);
-
- printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
- ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
-
- printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
- printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
- info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
- info.psi_siginfo.si_errno);
-
- printf("Before checking siginfo_t\n");
- ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
- ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_DBREG);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(dbregs_dr0_trap_variable_writeonly_byte);
-ATF_TC_HEAD(dbregs_dr0_trap_variable_writeonly_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on data writes only and 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_variable_writeonly_byte, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(0, 1, 0, true);
-}
-
-ATF_TC(dbregs_dr1_trap_variable_writeonly_byte);
-ATF_TC_HEAD(dbregs_dr1_trap_variable_writeonly_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on data writes only and 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_variable_writeonly_byte, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(1, 1, 0, true);
-}
-
-ATF_TC(dbregs_dr2_trap_variable_writeonly_byte);
-ATF_TC_HEAD(dbregs_dr2_trap_variable_writeonly_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on data writes only and 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_variable_writeonly_byte, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(2, 1, 0, true);
-}
-
-ATF_TC(dbregs_dr3_trap_variable_writeonly_byte);
-ATF_TC_HEAD(dbregs_dr3_trap_variable_writeonly_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on data writes only and 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_variable_writeonly_byte, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(3, 1, 0, true);
-}
-
-ATF_TC(dbregs_dr0_trap_variable_writeonly_2bytes);
-ATF_TC_HEAD(dbregs_dr0_trap_variable_writeonly_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on data writes only and 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_variable_writeonly_2bytes, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(0, 1, 1, true);
-}
-
-ATF_TC(dbregs_dr1_trap_variable_writeonly_2bytes);
-ATF_TC_HEAD(dbregs_dr1_trap_variable_writeonly_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on data writes only and 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_variable_writeonly_2bytes, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(1, 1, 1, true);
-}
-
-ATF_TC(dbregs_dr2_trap_variable_writeonly_2bytes);
-ATF_TC_HEAD(dbregs_dr2_trap_variable_writeonly_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on data writes only and 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_variable_writeonly_2bytes, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(2, 1, 1, true);
-}
-
-ATF_TC(dbregs_dr3_trap_variable_writeonly_2bytes);
-ATF_TC_HEAD(dbregs_dr3_trap_variable_writeonly_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on data writes only and 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_variable_writeonly_2bytes, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(3, 1, 1, true);
-}
-
-ATF_TC(dbregs_dr0_trap_variable_writeonly_4bytes);
-ATF_TC_HEAD(dbregs_dr0_trap_variable_writeonly_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on data writes only and 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_variable_writeonly_4bytes, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(0, 1, 3, true);
-}
-
-ATF_TC(dbregs_dr1_trap_variable_writeonly_4bytes);
-ATF_TC_HEAD(dbregs_dr1_trap_variable_writeonly_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on data writes only and 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_variable_writeonly_4bytes, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(1, 1, 3, true);
-}
-
-ATF_TC(dbregs_dr2_trap_variable_writeonly_4bytes);
-ATF_TC_HEAD(dbregs_dr2_trap_variable_writeonly_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on data writes only and 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_variable_writeonly_4bytes, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(2, 1, 3, true);
-}
-
-ATF_TC(dbregs_dr3_trap_variable_writeonly_4bytes);
-ATF_TC_HEAD(dbregs_dr3_trap_variable_writeonly_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on data writes only and 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_variable_writeonly_4bytes, tc)
-{
- /* 0b01 -- break on data write only */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(3, 1, 3, true);
-}
-
-ATF_TC(dbregs_dr0_trap_variable_readwrite_write_byte);
-ATF_TC_HEAD(dbregs_dr0_trap_variable_readwrite_write_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on data read/write trap in read 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_variable_readwrite_write_byte, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(0, 3, 0, true);
-}
-
-ATF_TC(dbregs_dr1_trap_variable_readwrite_write_byte);
-ATF_TC_HEAD(dbregs_dr1_trap_variable_readwrite_write_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on data read/write trap in read 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_variable_readwrite_write_byte, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(1, 3, 0, true);
-}
-
-ATF_TC(dbregs_dr2_trap_variable_readwrite_write_byte);
-ATF_TC_HEAD(dbregs_dr2_trap_variable_readwrite_write_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on data read/write trap in read 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_variable_readwrite_write_byte, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(2, 3, 0, true);
-}
-
-ATF_TC(dbregs_dr3_trap_variable_readwrite_write_byte);
-ATF_TC_HEAD(dbregs_dr3_trap_variable_readwrite_write_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on data read/write trap in read 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_variable_readwrite_write_byte, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(3, 3, 0, true);
-}
-
-ATF_TC(dbregs_dr0_trap_variable_readwrite_write_2bytes);
-ATF_TC_HEAD(dbregs_dr0_trap_variable_readwrite_write_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on data read/write trap in read 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_variable_readwrite_write_2bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(0, 3, 1, true);
-}
-
-ATF_TC(dbregs_dr1_trap_variable_readwrite_write_2bytes);
-ATF_TC_HEAD(dbregs_dr1_trap_variable_readwrite_write_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on data read/write trap in read 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_variable_readwrite_write_2bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(1, 3, 1, true);
-}
-
-ATF_TC(dbregs_dr2_trap_variable_readwrite_write_2bytes);
-ATF_TC_HEAD(dbregs_dr2_trap_variable_readwrite_write_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on data read/write trap in read 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_variable_readwrite_write_2bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(2, 3, 1, true);
-}
-
-ATF_TC(dbregs_dr3_trap_variable_readwrite_write_2bytes);
-ATF_TC_HEAD(dbregs_dr3_trap_variable_readwrite_write_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on data read/write trap in read 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_variable_readwrite_write_2bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(3, 3, 1, true);
-}
-
-ATF_TC(dbregs_dr0_trap_variable_readwrite_write_4bytes);
-ATF_TC_HEAD(dbregs_dr0_trap_variable_readwrite_write_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on data read/write trap in read 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_variable_readwrite_write_4bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(0, 3, 3, true);
-}
-
-ATF_TC(dbregs_dr1_trap_variable_readwrite_write_4bytes);
-ATF_TC_HEAD(dbregs_dr1_trap_variable_readwrite_write_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on data read/write trap in read 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_variable_readwrite_write_4bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(1, 3, 3, true);
-}
-
-ATF_TC(dbregs_dr2_trap_variable_readwrite_write_4bytes);
-ATF_TC_HEAD(dbregs_dr2_trap_variable_readwrite_write_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on data read/write trap in read 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_variable_readwrite_write_4bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(2, 3, 3, true);
-}
-
-ATF_TC(dbregs_dr3_trap_variable_readwrite_write_4bytes);
-ATF_TC_HEAD(dbregs_dr3_trap_variable_readwrite_write_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on data read/write trap in read 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_variable_readwrite_write_4bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(3, 3, 3, true);
-}
-
-ATF_TC(dbregs_dr0_trap_variable_readwrite_read_byte);
-ATF_TC_HEAD(dbregs_dr0_trap_variable_readwrite_read_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on data read/write trap in write 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_variable_readwrite_read_byte, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(0, 3, 0, false);
-}
-
-ATF_TC(dbregs_dr1_trap_variable_readwrite_read_byte);
-ATF_TC_HEAD(dbregs_dr1_trap_variable_readwrite_read_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on data read/write trap in write 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_variable_readwrite_read_byte, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(1, 3, 0, false);
-}
-
-ATF_TC(dbregs_dr2_trap_variable_readwrite_read_byte);
-ATF_TC_HEAD(dbregs_dr2_trap_variable_readwrite_read_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on data read/write trap in write 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_variable_readwrite_read_byte, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(2, 3, 0, false);
-}
-
-ATF_TC(dbregs_dr3_trap_variable_readwrite_read_byte);
-ATF_TC_HEAD(dbregs_dr3_trap_variable_readwrite_read_byte, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on data read/write trap in write 1 byte mode)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_variable_readwrite_read_byte, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b00 -- 1 byte */
-
- dbregs_trap_variable(3, 3, 0, false);
-}
-
-ATF_TC(dbregs_dr0_trap_variable_readwrite_read_2bytes);
-ATF_TC_HEAD(dbregs_dr0_trap_variable_readwrite_read_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on data read/write trap in write 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_variable_readwrite_read_2bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(0, 3, 1, false);
-}
-
-ATF_TC(dbregs_dr1_trap_variable_readwrite_read_2bytes);
-ATF_TC_HEAD(dbregs_dr1_trap_variable_readwrite_read_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on data read/write trap in write 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_variable_readwrite_read_2bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(1, 3, 1, false);
-}
-
-ATF_TC(dbregs_dr2_trap_variable_readwrite_read_2bytes);
-ATF_TC_HEAD(dbregs_dr2_trap_variable_readwrite_read_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on data read/write trap in write 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_variable_readwrite_read_2bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(2, 3, 1, false);
-}
-
-ATF_TC(dbregs_dr3_trap_variable_readwrite_read_2bytes);
-ATF_TC_HEAD(dbregs_dr3_trap_variable_readwrite_read_2bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on data read/write trap in write 2 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_variable_readwrite_read_2bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b01 -- 2 bytes */
-
- dbregs_trap_variable(3, 3, 1, false);
-}
-
-ATF_TC(dbregs_dr0_trap_variable_readwrite_read_4bytes);
-ATF_TC_HEAD(dbregs_dr0_trap_variable_readwrite_read_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on data read/write trap in write 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_variable_readwrite_read_4bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(0, 3, 3, false);
-}
-
-ATF_TC(dbregs_dr1_trap_variable_readwrite_read_4bytes);
-ATF_TC_HEAD(dbregs_dr1_trap_variable_readwrite_read_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on data read/write trap in write 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_variable_readwrite_read_4bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(1, 3, 3, false);
-}
-
-ATF_TC(dbregs_dr2_trap_variable_readwrite_read_4bytes);
-ATF_TC_HEAD(dbregs_dr2_trap_variable_readwrite_read_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on data read/write trap in write 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_variable_readwrite_read_4bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(2, 3, 3, false);
-}
-
-ATF_TC(dbregs_dr3_trap_variable_readwrite_read_4bytes);
-ATF_TC_HEAD(dbregs_dr3_trap_variable_readwrite_read_4bytes, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on data read/write trap in write 4 bytes mode)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_variable_readwrite_read_4bytes, tc)
-{
- /* 0b11 -- break on data write&read */
- /* 0b11 -- 4 bytes */
-
- dbregs_trap_variable(3, 3, 3, false);
-}
-
-#if defined(HAVE_DBREGS)
-ATF_TC(dbregs_dr0_trap_code);
-ATF_TC_HEAD(dbregs_dr0_trap_code, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR0 triggers SIGTRAP "
- "(break on code execution trap)");
-}
-
-ATF_TC_BODY(dbregs_dr0_trap_code, tc)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- struct dbreg r1;
- size_t i;
- volatile int watchme = 1;
- union u dr7;
-
- struct ptrace_siginfo info;
- memset(&info, 0, sizeof(info));
-
- dr7.raw = 0;
- dr7.bits.global_dr0_breakpoint = 1;
- dr7.bits.condition_dr0 = 0; /* 0b00 -- break on code execution */
- dr7.bits.len_dr0 = 0; /* 0b00 -- 1 byte */
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("check_happy(%d)=%d\n", watchme, check_happy(watchme));
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
-
- printf("State of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- r1.dr[0] = (long)(intptr_t)check_happy;
- printf("Set DR0 (r1.dr[0]) to new value %" PRIxREGISTER "\n",
- r1.dr[0]);
-
- r1.dr[7] = dr7.raw;
- printf("Set DR7 (r1.dr[7]) to new value %" PRIxREGISTER "\n",
- r1.dr[7]);
-
- printf("New state of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, SIGTRAP);
-
- printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
- ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
-
- printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
- printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
- info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
- info.psi_siginfo.si_errno);
-
- printf("Before checking siginfo_t\n");
- ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
- ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_DBREG);
-
- printf("Remove code trap from check_happy=%p\n", check_happy);
- dr7.bits.global_dr0_breakpoint = 0;
- r1.dr[7] = dr7.raw;
- printf("Set DR7 (r1.dr[7]) to new value %" PRIxREGISTER "\n",
- r1.dr[7]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-#endif
-
-#if defined(HAVE_DBREGS)
-ATF_TC(dbregs_dr1_trap_code);
-ATF_TC_HEAD(dbregs_dr1_trap_code, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR1 triggers SIGTRAP "
- "(break on code execution trap)");
-}
-
-ATF_TC_BODY(dbregs_dr1_trap_code, tc)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- struct dbreg r1;
- size_t i;
- volatile int watchme = 1;
- union u dr7;
-
- struct ptrace_siginfo info;
- memset(&info, 0, sizeof(info));
-
- dr7.raw = 0;
- dr7.bits.global_dr1_breakpoint = 1;
- dr7.bits.condition_dr1 = 0; /* 0b00 -- break on code execution */
- dr7.bits.len_dr1 = 0; /* 0b00 -- 1 byte */
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("check_happy(%d)=%d\n", watchme, check_happy(watchme));
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
-
- printf("State of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- r1.dr[1] = (long)(intptr_t)check_happy;
- printf("Set DR1 (r1.dr[1]) to new value %" PRIxREGISTER "\n",
- r1.dr[1]);
-
- r1.dr[7] = dr7.raw;
- printf("Set DR7 (r1.dr[7]) to new value %" PRIxREGISTER "\n",
- r1.dr[7]);
-
- printf("New state of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, SIGTRAP);
-
- printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
- ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
-
- printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
- printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
- info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
- info.psi_siginfo.si_errno);
-
- printf("Before checking siginfo_t\n");
- ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
- ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_DBREG);
-
- printf("Remove code trap from check_happy=%p\n", check_happy);
- dr7.bits.global_dr1_breakpoint = 0;
- r1.dr[7] = dr7.raw;
- printf("Set DR7 (r1.dr[7]) to new value %" PRIxREGISTER "\n",
- r1.dr[7]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-#endif
-
-#if defined(HAVE_DBREGS)
-ATF_TC(dbregs_dr2_trap_code);
-ATF_TC_HEAD(dbregs_dr2_trap_code, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR2 triggers SIGTRAP "
- "(break on code execution trap)");
-}
-
-ATF_TC_BODY(dbregs_dr2_trap_code, tc)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- struct dbreg r1;
- size_t i;
- volatile int watchme = 1;
- union u dr7;
-
- struct ptrace_siginfo info;
- memset(&info, 0, sizeof(info));
-
- dr7.raw = 0;
- dr7.bits.global_dr2_breakpoint = 1;
- dr7.bits.condition_dr2 = 0; /* 0b00 -- break on code execution */
- dr7.bits.len_dr2 = 0; /* 0b00 -- 1 byte */
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("check_happy(%d)=%d\n", watchme, check_happy(watchme));
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
-
- printf("State of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- r1.dr[2] = (long)(intptr_t)check_happy;
- printf("Set DR2 (r1.dr[2]) to new value %" PRIxREGISTER "\n",
- r1.dr[2]);
-
- r1.dr[7] = dr7.raw;
- printf("Set DR7 (r1.dr[7]) to new value %" PRIxREGISTER "\n",
- r1.dr[7]);
-
- printf("New state of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, SIGTRAP);
-
- printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
- ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
-
- printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
- printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
- info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
- info.psi_siginfo.si_errno);
-
- printf("Before checking siginfo_t\n");
- ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
- ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_DBREG);
-
- printf("Remove code trap from check_happy=%p\n", check_happy);
- dr7.bits.global_dr2_breakpoint = 0;
- r1.dr[7] = dr7.raw;
- printf("Set DR7 (r1.dr[7]) to new value %" PRIxREGISTER "\n",
- r1.dr[7]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-#endif
-
-#if defined(HAVE_DBREGS)
-ATF_TC(dbregs_dr3_trap_code);
-ATF_TC_HEAD(dbregs_dr3_trap_code, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that setting trap with DR3 triggers SIGTRAP "
- "(break on code execution trap)");
-}
-
-ATF_TC_BODY(dbregs_dr3_trap_code, tc)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- struct dbreg r1;
- size_t i;
- volatile int watchme = 1;
- union u dr7;
-
- struct ptrace_siginfo info;
- memset(&info, 0, sizeof(info));
-
- dr7.raw = 0;
- dr7.bits.global_dr3_breakpoint = 1;
- dr7.bits.condition_dr3 = 0; /* 0b00 -- break on code execution */
- dr7.bits.len_dr3 = 0; /* 0b00 -- 1 byte */
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("check_happy(%d)=%d\n", watchme, check_happy(watchme));
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
-
- printf("State of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- r1.dr[3] = (long)(intptr_t)check_happy;
- printf("Set DR3 (r1.dr[3]) to new value %" PRIxREGISTER "\n",
- r1.dr[3]);
-
- r1.dr[7] = dr7.raw;
- printf("Set DR7 (r1.dr[7]) to new value %" PRIxREGISTER "\n",
- r1.dr[7]);
-
- printf("New state of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, SIGTRAP);
-
- printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
- ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
-
- printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
- printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
- info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
- info.psi_siginfo.si_errno);
-
- printf("Before checking siginfo_t\n");
- ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
- ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_DBREG);
-
- printf("Remove code trap from check_happy=%p\n", check_happy);
- dr7.bits.global_dr3_breakpoint = 0;
- r1.dr[7] = dr7.raw;
- printf("Set DR7 (r1.dr[7]) to new value %" PRIxREGISTER "\n",
- r1.dr[7]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Call CONTINUE for the child process\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-#endif
-
-volatile lwpid_t the_lwp_id = 0;
-
-static void __used
-lwp_main_func(void *arg)
-{
- the_lwp_id = _lwp_self();
- _lwp_exit();
-}
-
-static void
-dbregs_dont_inherit_lwp(int reg)
-{
- const int exitval = 5;
- const int sigval = SIGSTOP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- ptrace_state_t state;
- const int slen = sizeof(state);
- ptrace_event_t event;
- const int elen = sizeof(event);
- ucontext_t uc;
- lwpid_t lid;
- static const size_t ssize = 16*1024;
- void *stack;
- size_t i;
- struct dbreg r1;
- struct dbreg r2;
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before allocating memory for stack in child\n");
- FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
-
- printf("Before making context for new lwp in child\n");
- _lwp_makecontext(&uc, lwp_main_func, NULL, NULL, stack, ssize);
-
- printf("Before creating new in child\n");
- FORKEE_ASSERT(_lwp_create(&uc, 0, &lid) == 0);
-
- printf("Before waiting for lwp %d to exit\n", lid);
- FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0);
-
- printf("Before verifying that reported %d and running lid %d "
- "are the same\n", lid, the_lwp_id);
- FORKEE_ASSERT_EQ(lid, the_lwp_id);
-
- printf("Before exiting of the child process\n");
- _exit(exitval);
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Set empty EVENT_MASK for the child %d\n", child);
- event.pe_set_event = PTRACE_LWP_CREATE;
- ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
-
- printf("Call GETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
-
- printf("State of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- r1.dr[reg] = (long)(intptr_t)check_happy;
- printf("Set DR%d (r1.dr[%d]) to new value %" PRIxREGISTER "\n",
- reg, reg, r1.dr[0]);
-
- printf("New state of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child - expected stopped "
- "SIGTRAP\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, SIGTRAP);
-
- ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
-
- ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_LWP_CREATE);
-
- lid = state.pe_lwp;
- printf("Reported PTRACE_LWP_CREATE event with lid %d\n", lid);
-
- printf("Call GETDBREGS for the child process new lwp (r2)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r2, lid) != -1);
-
- printf("State of the debug registers (r2):\n");
- for (i = 0; i < __arraycount(r2.dr); i++)
- printf("r2[%zu]=%" PRIxREGISTER "\n", i, r2.dr[i]);
-
- printf("Assert that (r1) and (r2) are not the same\n");
- ATF_REQUIRE(memcmp(&r1, &r2, sizeof(r1)) != 0);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child - expected exited\n",
- TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_exited(status, exitval);
-
- printf("Before calling %s() for the child - expected no process\n",
- TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(dbregs_dr0_dont_inherit_lwp);
-ATF_TC_HEAD(dbregs_dr0_dont_inherit_lwp, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that 1 LWP creation is intercepted by ptrace(2) with "
- "EVENT_MASK set to PTRACE_LWP_CREATE and Debug Register 0 from "
- "the forker thread is not inherited");
-}
-
-ATF_TC_BODY(dbregs_dr0_dont_inherit_lwp, tc)
-{
- dbregs_dont_inherit_lwp(0);
-}
-
-ATF_TC(dbregs_dr1_dont_inherit_lwp);
-ATF_TC_HEAD(dbregs_dr1_dont_inherit_lwp, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that 1 LWP creation is intercepted by ptrace(2) with "
- "EVENT_MASK set to PTRACE_LWP_CREATE and Debug Register 1 from "
- "the forker thread is not inherited");
-}
-
-ATF_TC_BODY(dbregs_dr1_dont_inherit_lwp, tc)
-{
- dbregs_dont_inherit_lwp(1);
-}
-
-ATF_TC(dbregs_dr2_dont_inherit_lwp);
-ATF_TC_HEAD(dbregs_dr2_dont_inherit_lwp, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that 1 LWP creation is intercepted by ptrace(2) with "
- "EVENT_MASK set to PTRACE_LWP_CREATE and Debug Register 2 from "
- "the forker thread is not inherited");
-}
-
-ATF_TC_BODY(dbregs_dr2_dont_inherit_lwp, tc)
-{
- dbregs_dont_inherit_lwp(2);
-}
-
-ATF_TC(dbregs_dr3_dont_inherit_lwp);
-ATF_TC_HEAD(dbregs_dr3_dont_inherit_lwp, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that 1 LWP creation is intercepted by ptrace(2) with "
- "EVENT_MASK set to PTRACE_LWP_CREATE and Debug Register 3 from "
- "the forker thread is not inherited");
-}
-
-ATF_TC_BODY(dbregs_dr3_dont_inherit_lwp, tc)
-{
- dbregs_dont_inherit_lwp(3);
-}
-
-static void
-dbregs_dont_inherit_execve(int reg)
-{
- const int sigval = SIGTRAP;
- pid_t child, wpid;
-#if defined(TWAIT_HAVE_STATUS)
- int status;
-#endif
- size_t i;
- struct dbreg r1;
- struct dbreg r2;
-
- struct ptrace_siginfo info;
- memset(&info, 0, sizeof(info));
-
- printf("Before forking process PID=%d\n", getpid());
- ATF_REQUIRE((child = fork()) != -1);
- if (child == 0) {
- printf("Before calling PT_TRACE_ME from child %d\n", getpid());
- FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
- printf("Before raising %s from child\n", strsignal(sigval));
- FORKEE_ASSERT(raise(sigval) == 0);
-
- printf("Before calling execve(2) from child\n");
- execlp("/bin/echo", "/bin/echo", NULL);
-
- FORKEE_ASSERT(0 && "Not reached");
- }
- printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Call GETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r1, 0) != -1);
-
- printf("State of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- r1.dr[reg] = (long)(intptr_t)check_happy;
- printf("Set DR%d (r1.dr[%d]) to new value %" PRIxREGISTER "\n",
- reg, reg, r1.dr[reg]);
-
- printf("New state of the debug registers (r1):\n");
- for (i = 0; i < __arraycount(r1.dr); i++)
- printf("r1[%zu]=%" PRIxREGISTER "\n", i, r1.dr[i]);
-
- printf("Call SETDBREGS for the child process (r1)\n");
- ATF_REQUIRE(ptrace(PT_SETDBREGS, child, &r1, 0) != -1);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- validate_status_stopped(status, sigval);
-
- printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
- ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
-
- printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
- printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
- info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
- info.psi_siginfo.si_errno);
-
- ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval);
- ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_EXEC);
-
- printf("Call GETDBREGS for the child process after execve(2)\n");
- ATF_REQUIRE(ptrace(PT_GETDBREGS, child, &r2, 0) != -1);
-
- printf("State of the debug registers (r2):\n");
- for (i = 0; i < __arraycount(r2.dr); i++)
- printf("r2[%zu]=%" PRIxREGISTER "\n", i, r2.dr[i]);
-
- printf("Assert that (r1) and (r2) are not the same\n");
- ATF_REQUIRE(memcmp(&r1, &r2, sizeof(r1)) != 0);
-
- printf("Before resuming the child process where it left off and "
- "without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
-
- printf("Before calling %s() for the child\n", TWAIT_FNAME);
- TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
-}
-
-ATF_TC(dbregs_dr0_dont_inherit_execve);
-ATF_TC_HEAD(dbregs_dr0_dont_inherit_execve, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that execve(2) is intercepted by tracer and Debug "
- "Register 0 is reset");
-}
-
-ATF_TC_BODY(dbregs_dr0_dont_inherit_execve, tc)
-{
- dbregs_dont_inherit_execve(0);
-}
-
-ATF_TC(dbregs_dr1_dont_inherit_execve);
-ATF_TC_HEAD(dbregs_dr1_dont_inherit_execve, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that execve(2) is intercepted by tracer and Debug "
- "Register 1 is reset");
-}
-
-ATF_TC_BODY(dbregs_dr1_dont_inherit_execve, tc)
-{
- dbregs_dont_inherit_execve(1);
-}
-
-ATF_TC(dbregs_dr2_dont_inherit_execve);
-ATF_TC_HEAD(dbregs_dr2_dont_inherit_execve, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that execve(2) is intercepted by tracer and Debug "
- "Register 2 is reset");
-}
-
-ATF_TC_BODY(dbregs_dr2_dont_inherit_execve, tc)
-{
- dbregs_dont_inherit_execve(2);
-}
-
-ATF_TC(dbregs_dr3_dont_inherit_execve);
-ATF_TC_HEAD(dbregs_dr3_dont_inherit_execve, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Verify that execve(2) is intercepted by tracer and Debug "
- "Register 3 is reset");
-}
-
-ATF_TC_BODY(dbregs_dr3_dont_inherit_execve, tc)
-{
- dbregs_dont_inherit_execve(3);
-}
-
-ATF_TP_ADD_TCS(tp)
-{
- setvbuf(stdout, NULL, _IONBF, 0);
- setvbuf(stderr, NULL, _IONBF, 0);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_print);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr0);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr1);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr2);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr3);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr0_yield);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr1_yield);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr2_yield);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr3_yield);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr0_continued);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr1_continued);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr2_continued);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_preserve_dr3_continued);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_variable_writeonly_byte);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_variable_writeonly_byte);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_variable_writeonly_byte);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_variable_writeonly_byte);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_variable_writeonly_2bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_variable_writeonly_2bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_variable_writeonly_2bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_variable_writeonly_2bytes);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_variable_writeonly_4bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_variable_writeonly_4bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_variable_writeonly_4bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_variable_writeonly_4bytes);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_variable_readwrite_write_byte);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_variable_readwrite_write_byte);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_variable_readwrite_write_byte);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_variable_readwrite_write_byte);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_variable_readwrite_write_2bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_variable_readwrite_write_2bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_variable_readwrite_write_2bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_variable_readwrite_write_2bytes);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_variable_readwrite_write_4bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_variable_readwrite_write_4bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_variable_readwrite_write_4bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_variable_readwrite_write_4bytes);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_variable_readwrite_read_byte);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_variable_readwrite_read_byte);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_variable_readwrite_read_byte);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_variable_readwrite_read_byte);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_variable_readwrite_read_2bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_variable_readwrite_read_2bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_variable_readwrite_read_2bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_variable_readwrite_read_2bytes);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_variable_readwrite_read_4bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_variable_readwrite_read_4bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_variable_readwrite_read_4bytes);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_variable_readwrite_read_4bytes);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_trap_code);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_trap_code);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_trap_code);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_trap_code);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_dont_inherit_lwp);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_dont_inherit_lwp);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_dont_inherit_lwp);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_dont_inherit_lwp);
-
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr0_dont_inherit_execve);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr1_dont_inherit_execve);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr2_dont_inherit_execve);
- ATF_TP_ADD_TC_HAVE_DBREGS(tp, dbregs_dr3_dont_inherit_execve);
-
- return atf_no_error();
-}
diff --git a/tests/kernel/arch/x86/t_ptrace_wait3.c b/tests/kernel/arch/x86/t_ptrace_wait3.c
deleted file mode 100644
index 1e6e93f957f..00000000000
--- a/tests/kernel/arch/x86/t_ptrace_wait3.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_wait3.c,v 1.1 2017/02/22 01:07:13 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAIT3
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/x86/t_ptrace_wait4.c b/tests/kernel/arch/x86/t_ptrace_wait4.c
deleted file mode 100644
index 685b9b39f40..00000000000
--- a/tests/kernel/arch/x86/t_ptrace_wait4.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_wait4.c,v 1.1 2017/02/22 01:07:13 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAIT4
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/x86/t_ptrace_wait6.c b/tests/kernel/arch/x86/t_ptrace_wait6.c
deleted file mode 100644
index ac2560abc91..00000000000
--- a/tests/kernel/arch/x86/t_ptrace_wait6.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_wait6.c,v 1.1 2017/02/22 01:07:13 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAIT6
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/x86/t_ptrace_waitid.c b/tests/kernel/arch/x86/t_ptrace_waitid.c
deleted file mode 100644
index 5572fafdfd4..00000000000
--- a/tests/kernel/arch/x86/t_ptrace_waitid.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_waitid.c,v 1.1 2017/02/22 01:07:13 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAITID
-#include "t_ptrace_wait.c"
diff --git a/tests/kernel/arch/x86/t_ptrace_waitpid.c b/tests/kernel/arch/x86/t_ptrace_waitpid.c
deleted file mode 100644
index 277772fef5c..00000000000
--- a/tests/kernel/arch/x86/t_ptrace_waitpid.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2017/02/22 01:07:13 kamil Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TWAIT_WAITPID
-#include "t_ptrace_wait.c"