aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorEric Badger <badger@FreeBSD.org>2017-02-20 15:53:16 +0000
committerEric Badger <badger@FreeBSD.org>2017-02-20 15:53:16 +0000
commit82a4538f31fb0bc4bdd7a1c68bcfcd8a7db10331 (patch)
tree05e934fc1fd7bb9183c01a350ff1a261c962b9b8 /sys/kern/kern_fork.c
parent31735ccf8af9186150a7de24784b28d6683d7555 (diff)
downloadsrc-82a4538f31fb0bc4bdd7a1c68bcfcd8a7db10331.tar.gz
src-82a4538f31fb0bc4bdd7a1c68bcfcd8a7db10331.zip
Defer ptracestop() signals that cannot be delivered immediately
When a thread is stopped in ptracestop(), the ptrace(2) user may request a signal be delivered upon resumption of the thread. Heretofore, those signals were discarded unless ptracestop()'s caller was issignal(). Fix this by modifying ptracestop() to queue up signals requested by the ptrace user that will be delivered when possible. Take special care when the signal is SIGKILL (usually generated from a PT_KILL request); no new stop events should be triggered after a PT_KILL. Add a number of tests for the new functionality. Several tests were authored by jhb. PR: 212607 Reviewed by: kib Approved by: kib (mentor) MFC after: 2 weeks Sponsored by: Dell EMC In collaboration with: jhb Differential Revision: https://reviews.freebsd.org/D9260
Notes
Notes: svn path=/head/; revision=313992
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 7e340a9cdc9b..92bbcd72cea3 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1081,7 +1081,7 @@ fork_return(struct thread *td, struct trapframe *frame)
proc_reparent(p, dbg);
sx_xunlock(&proctree_lock);
td->td_dbgflags |= TDB_CHILD | TDB_SCX | TDB_FSTP;
- ptracestop(td, SIGSTOP);
+ ptracestop(td, SIGSTOP, NULL);
td->td_dbgflags &= ~(TDB_CHILD | TDB_SCX);
} else {
/*
@@ -1102,7 +1102,7 @@ fork_return(struct thread *td, struct trapframe *frame)
_STOPEVENT(p, S_SCX, td->td_dbg_sc_code);
if ((p->p_ptevents & PTRACE_SCX) != 0 ||
(td->td_dbgflags & TDB_BORN) != 0)
- ptracestop(td, SIGTRAP);
+ ptracestop(td, SIGTRAP, NULL);
td->td_dbgflags &= ~(TDB_SCX | TDB_BORN);
PROC_UNLOCK(p);
}