| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: t_ptrace_wait.c,v 1.39 2016/12/04 23:48:02 kamil Exp $ */ | | 1 | /* $NetBSD: t_ptrace_wait.c,v 1.40 2016/12/05 07:18:10 kamil Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2016 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2016 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __RCSID("$NetBSD: t_ptrace_wait.c,v 1.39 2016/12/04 23:48:02 kamil Exp $"); | | 30 | __RCSID("$NetBSD: t_ptrace_wait.c,v 1.40 2016/12/05 07:18:10 kamil Exp $"); |
31 | | | 31 | |
32 | #include <sys/param.h> | | 32 | #include <sys/param.h> |
33 | #include <sys/types.h> | | 33 | #include <sys/types.h> |
34 | #include <sys/ptrace.h> | | 34 | #include <sys/ptrace.h> |
35 | #include <sys/resource.h> | | 35 | #include <sys/resource.h> |
36 | #include <sys/stat.h> | | 36 | #include <sys/stat.h> |
37 | #include <sys/sysctl.h> | | 37 | #include <sys/sysctl.h> |
38 | #include <sys/wait.h> | | 38 | #include <sys/wait.h> |
39 | #include <machine/reg.h> | | 39 | #include <machine/reg.h> |
40 | #include <err.h> | | 40 | #include <err.h> |
41 | #include <errno.h> | | 41 | #include <errno.h> |
42 | #include <signal.h> | | 42 | #include <signal.h> |
43 | #include <stdint.h> | | 43 | #include <stdint.h> |
| @@ -4699,26 +4699,32 @@ ATF_TC_HEAD(lwpinfo2, tc) | | | @@ -4699,26 +4699,32 @@ ATF_TC_HEAD(lwpinfo2, tc) |
4699 | ATF_TC_BODY(lwpinfo2, tc) | | 4699 | ATF_TC_BODY(lwpinfo2, tc) |
4700 | { | | 4700 | { |
4701 | int fds_totracee[2], fds_totracer[2], fds_fromtracer[2]; | | 4701 | int fds_totracee[2], fds_totracer[2], fds_fromtracer[2]; |
4702 | int rv; | | 4702 | int rv; |
4703 | const int exitval_tracee = 5; | | 4703 | const int exitval_tracee = 5; |
4704 | const int exitval_tracer = 10; | | 4704 | const int exitval_tracer = 10; |
4705 | pid_t tracee, tracer, wpid; | | 4705 | pid_t tracee, tracer, wpid; |
4706 | uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ | | 4706 | uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ |
4707 | #if defined(TWAIT_HAVE_STATUS) | | 4707 | #if defined(TWAIT_HAVE_STATUS) |
4708 | int status; | | 4708 | int status; |
4709 | #endif | | 4709 | #endif |
4710 | struct ptrace_lwpinfo info = {0}; | | 4710 | struct ptrace_lwpinfo info = {0}; |
4711 | | | 4711 | |
| | | 4712 | /* |
| | | 4713 | * ptrace(2): Signal does not set PL_EVENT_SIGNAL inOB |
| | | 4714 | * (struct ptrace_lwpinfo.)pl_event |
| | | 4715 | */ |
| | | 4716 | atf_tc_expect_fail("PR kern/51685"); |
| | | 4717 | |
4712 | printf("Spawn tracee\n"); | | 4718 | printf("Spawn tracee\n"); |
4713 | ATF_REQUIRE(pipe(fds_totracee) == 0); | | 4719 | ATF_REQUIRE(pipe(fds_totracee) == 0); |
4714 | tracee = atf_utils_fork(); | | 4720 | tracee = atf_utils_fork(); |
4715 | if (tracee == 0) { | | 4721 | if (tracee == 0) { |
4716 | FORKEE_ASSERT(close(fds_totracee[1]) == 0); | | 4722 | FORKEE_ASSERT(close(fds_totracee[1]) == 0); |
4717 | | | 4723 | |
4718 | /* Wait for message from the parent */ | | 4724 | /* Wait for message from the parent */ |
4719 | rv = read(fds_totracee[0], &msg, sizeof(msg)); | | 4725 | rv = read(fds_totracee[0], &msg, sizeof(msg)); |
4720 | FORKEE_ASSERT(rv == sizeof(msg)); | | 4726 | FORKEE_ASSERT(rv == sizeof(msg)); |
4721 | | | 4727 | |
4722 | _exit(exitval_tracee); | | 4728 | _exit(exitval_tracee); |
4723 | } | | 4729 | } |
4724 | ATF_REQUIRE(close(fds_totracee[0]) == 0); | | 4730 | ATF_REQUIRE(close(fds_totracee[0]) == 0); |