summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-09-13 15:51:18 +0000
committerjhb <jhb@FreeBSD.org>2012-09-13 15:51:18 +0000
commit1e4174de1a4f6a3cd6d80a545ec7187ecc402d68 (patch)
tree0776d8701c7affd40cb32386af9dfa7fc3e33f2f /sys/kern/kern_exit.c
parenta312b7ef4e0305785acfab807d352fe859634f31 (diff)
downloadFreeBSD-src-1e4174de1a4f6a3cd6d80a545ec7187ecc402d68.zip
FreeBSD-src-1e4174de1a4f6a3cd6d80a545ec7187ecc402d68.tar.gz
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
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 dc3a658..59f31f5 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.
OpenPOWER on IntegriCloud