Module Name: src
Committed By: bouyer
Date: Sat Mar 17 19:14:10 UTC 2012
Modified Files:
src/sys/kern [netbsd-5]: kern_sig.c
Log Message:
Pull up following revision(s) (requested by christos in ticket #1741):
sys/kern/kern_sig.c: revision 1.300
kpsignal2: do not make the signal pending twice when tracing the process,
also update a comment and add an assert. Fixes PR/42309 by Nicolas Joly.
To generate a diff of this commit:
cvs rdiff -u -r1.289.4.7 -r1.289.4.8 src/sys/kern/kern_sig.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.289.4.7 src/sys/kern/kern_sig.c:1.289.4.8
--- src/sys/kern/kern_sig.c:1.289.4.7 Sat Feb 4 16:57:58 2012
+++ src/sys/kern/kern_sig.c Sat Mar 17 19:14:08 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sig.c,v 1.289.4.7 2012/02/04 16:57:58 bouyer Exp $ */
+/* $NetBSD: kern_sig.c,v 1.289.4.8 2012/03/17 19:14:08 bouyer Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.289.4.7 2012/02/04 16:57:58 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.289.4.8 2012/03/17 19:14:08 bouyer Exp $");
#include "opt_ptrace.h"
#include "opt_compat_sunos.h"
@@ -1393,15 +1393,13 @@ kpsignal2(struct proc *p, ksiginfo_t *ks
goto out;
} else {
/*
- * Process is stopped or stopping. If traced, then no
- * further action is necessary.
+ * Process is stopped or stopping.
+ * - If traced, then no action is needed, unless killing.
+ * - Run the process only if sending SIGCONT or SIGKILL.
*/
- if ((p->p_slflag & PSL_TRACED) != 0 && signo != SIGKILL)
+ if ((p->p_slflag & PSL_TRACED) != 0 && signo != SIGKILL) {
goto out;
-
- /*
- * Run the process only if sending SIGCONT or SIGKILL.
- */
+ }
if ((prop & SA_CONT) != 0 || signo == SIGKILL) {
/*
* Re-adjust p_nstopchild if the process wasn't
@@ -1409,9 +1407,13 @@ kpsignal2(struct proc *p, ksiginfo_t *ks
*/
p->p_stat = SACTIVE;
p->p_sflag &= ~PS_STOPPING;
- if (!p->p_waited)
+ if (!p->p_waited) {
p->p_pptr->p_nstopchild--;
-
+ }
+ if (p->p_slflag & PSL_TRACED) {
+ KASSERT(signo == SIGKILL);
+ goto deliver;
+ }
/*
* Do not make signal pending if SIGCONT is default.
*
@@ -1434,6 +1436,7 @@ kpsignal2(struct proc *p, ksiginfo_t *ks
/*
* Make signal pending.
*/
+ KASSERT((p->p_slflag & PSL_TRACED) == 0);
sigput(&p->p_sigpend, p, kp);
deliver: