Defer ptracestop() signals that cannot be delivered immediately
authorbadger <badger@FreeBSD.org>
Mon, 20 Feb 2017 15:53:16 +0000 (15:53 +0000)
committerbadger <badger@FreeBSD.org>
Mon, 20 Feb 2017 15:53:16 +0000 (15:53 +0000)
commitdac7240a4b9da74176041b93010298ff90cc9176
tree05e934fc1fd7bb9183c01a350ff1a261c962b9b8
parent23c80c3239f1ed0ea199878577c98527283ac9f0
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
sys/kern/kern_fork.c
sys/kern/kern_sig.c
sys/kern/kern_thr.c
sys/kern/subr_syscall.c
sys/kern/sys_process.c
sys/sys/signalvar.h
tests/sys/kern/Makefile
tests/sys/kern/ptrace_test.c