Source-Changes-HG archive

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

[src/trunk]: src/tests/kernel Mark syscall1 broken in t_ptrace_wait*



details:   https://anonhg.NetBSD.org/src/rev/ba9e61cb3673
branches:  trunk
changeset: 351840:ba9e61cb3673
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed Mar 01 08:05:15 2017 +0000

description:
Mark syscall1 broken in t_ptrace_wait*

Mark this test broken with kern/52012 as the tracee does not stop on syscall
entry. Check for siginfo(2) in syscall1 and unveil two new bugs.

PR kern/52012: PT_SYSCALL does not stop on syscall entry
PR kern/52018: ptrace(2) PT_SYSCALL generates SIGTRAP without si_code
PR kern/52019: ptrace(2) PT_SYSCALL generate SIGTRAP to the parent but
               returns SIGSTOP in PT_GET_SIGINFO

Sponsored by <The NetBSD Foundation>

diffstat:

 tests/kernel/t_ptrace_wait.c |  21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diffs (56 lines):

diff -r 02a5e9190e96 -r ba9e61cb3673 tests/kernel/t_ptrace_wait.c
--- a/tests/kernel/t_ptrace_wait.c      Wed Mar 01 03:02:48 2017 +0000
+++ b/tests/kernel/t_ptrace_wait.c      Wed Mar 01 08:05:15 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ptrace_wait.c,v 1.75 2017/02/28 13:29:52 kamil Exp $ */
+/*     $NetBSD: t_ptrace_wait.c,v 1.76 2017/03/01 08:05:15 kamil Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.75 2017/02/28 13:29:52 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.76 2017/03/01 08:05:15 kamil Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -7419,6 +7419,10 @@
 #if defined(TWAIT_HAVE_STATUS)
        int status;
 #endif
+       struct ptrace_siginfo info;
+       memset(&info, 0, sizeof(info));
+
+       atf_tc_expect_fail("PR kern/52012 PR kern/52018 PR kern/52019");
 
        printf("Before forking process PID=%d\n", getpid());
        ATF_REQUIRE((child = fork()) != -1);
@@ -7450,6 +7454,12 @@
 
        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);
+
+       ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+       ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCE);
+
        printf("Before resuming the child process where it left off and "
            "without signal to be sent\n");
        ATF_REQUIRE(ptrace(PT_SYSCALL, child, (void *)1, 0) != -1);
@@ -7459,6 +7469,13 @@
 
        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("Before checking siginfo_t\n");
+       ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+       ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCX);
+
        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);



Home | Main Index | Thread Index | Old Index