aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2012-09-13 15:51:18 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2012-09-13 15:51:18 +0000
commit0f14f15b62ced09a2eb935dd174f8baf1cbb9657 (patch)
tree0776d8701c7affd40cb32386af9dfa7fc3e33f2f /sys/kern/kern_exit.c
parent2bfb8a83f62f3f9814772161e31d2d149724c808 (diff)
downloadsrc-0f14f15b62ced09a2eb935dd174f8baf1cbb9657.tar.gz
src-0f14f15b62ced09a2eb935dd174f8baf1cbb9657.zip
Ignore stop and continue signals sent to an exiting process. Stop signals
set p_xstat to the signal that triggered the stop, but p_xstat is also used to hold the exit status of an exiting process. Without this change, a stop signal that arrived after a process was marked P_WEXIT but before it was marked a zombie would overwrite the exit status with the stop signal number. Reviewed by: kib MFC after: 1 week
Notes
Notes: svn path=/head/; revision=240467
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index dc3a6581af75..59f31f5901d8 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -200,6 +200,14 @@ exit1(struct thread *td, int rv)
_STOPEVENT(p, S_EXIT, rv);
/*
+ * Ignore any pending request to stop due to a stop signal.
+ * Once P_WEXIT is set, future requests will be ignored as
+ * well.
+ */
+ p->p_flag &= ~P_STOPPED_SIG;
+ KASSERT(!P_SHOULDSTOP(p), ("exiting process is stopped"));
+
+ /*
* Note that we are exiting and do another wakeup of anyone in
* PIOCWAIT in case they aren't listening for S_EXIT stops or
* decided to wait again after we told them we are exiting.