Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177599390
D44564.1794819390.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D44564.1794819390.diff
View Options
diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c
--- a/tests/sys/kern/ptrace_test.c
+++ b/tests/sys/kern/ptrace_test.c
@@ -4368,6 +4368,47 @@
ATF_REQUIRE(ptrace(PT_DETACH, fpid, (caddr_t)1, 0) != -1);
}
+/*
+ * Make sure that procctl(PROC_REAP_KILL) can kill a process that's stopped
+ * waiting for a debugger.
+ */
+ATF_TC_WITHOUT_HEAD(ptrace__reap_kill_stopped);
+ATF_TC_BODY(ptrace__reap_kill_stopped, tc)
+{
+ struct procctl_reaper_kill prk;
+ pid_t debuggee, killer, wpid;
+ int status;
+
+ REQUIRE_EQ(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL), 0);
+
+ debuggee = fork();
+ ATF_REQUIRE(debuggee >= 0);
+ if (debuggee == 0) {
+ trace_me();
+ exit(0);
+ }
+ attach_child(debuggee);
+
+ killer = fork();
+ ATF_REQUIRE(killer >= 0);
+ if (killer == 0) {
+ int error;
+
+ memset(&prk, 0, sizeof(prk));
+ prk.rk_sig = SIGINT;
+ error = procctl(P_PID, getppid(), PROC_REAP_KILL, &prk);
+ CHILD_REQUIRE_EQ(error, 0);
+ CHILD_REQUIRE_EQ(1, prk.rk_killed);
+ CHILD_REQUIRE_EQ(-1, prk.rk_fpid);
+ _exit(0);
+ }
+
+ wpid = waitpid(killer, &status, 0);
+ REQUIRE_EQ(wpid, killer);
+ ATF_REQUIRE_MSG(WEXITSTATUS(status) == 0,
+ "killer failed with error %d", WEXITSTATUS(status));
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, ptrace__parent_wait_after_trace_me);
@@ -4434,6 +4475,7 @@
ATF_TP_ADD_TC(tp, ptrace__procdesc_wait_child);
ATF_TP_ADD_TC(tp, ptrace__procdesc_reparent_wait_child);
ATF_TP_ADD_TC(tp, ptrace__PT_SC_REMOTE_getpid);
+ ATF_TP_ADD_TC(tp, ptrace__reap_kill_stopped);
return (atf_no_error());
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 16, 8:56 AM (11 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41769972
Default Alt Text
D44564.1794819390.diff (1 KB)
Attached To
Mode
D44564: ptrace: Add a test using PROC_REAP_KILL to kill a stopped debuggee
Attached
Detach File
Event Timeline