summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authorjoshe <joshe@openbsd.org>2011-11-22 23:20:19 +0000
committerjoshe <joshe@openbsd.org>2011-11-22 23:20:19 +0000
commita9b1ac2111b2ea40bc796c5c55e432f4bfed8207 (patch)
tree0c199f9fafbd65de79f24d4e659656bd21a10831 /sys/kern/kern_sig.c
parentAdd a test for forked processes inheriting their parent's signal stack. (diff)
downloadwireguard-openbsd-a9b1ac2111b2ea40bc796c5c55e432f4bfed8207.tar.xz
wireguard-openbsd-a9b1ac2111b2ea40bc796c5c55e432f4bfed8207.zip
Move struct proc's sigaltstack struct from the zeroed area into the
copied area, and initialize it properly in the FORK_THREAD case. This restores the behavior of a forked process inheriting its parent's signal stack. ok guenther@
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 360443f08c5..9d1c5d845d5 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.129 2011/11/16 20:50:19 deraadt Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.130 2011/11/22 23:20:19 joshe Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -170,6 +170,17 @@ sigactsshare(struct proc *p)
}
/*
+ * Initialize a new sigaltstack structure.
+ */
+void
+sigstkinit(struct sigaltstack *ss)
+{
+ ss->ss_flags = SS_DISABLE;
+ ss->ss_size = 0;
+ ss->ss_sp = 0;
+}
+
+/*
* Make this process not share its sigacts, maintaining all
* signal state.
*/
@@ -383,9 +394,7 @@ execsigs(struct proc *p)
* Reset stack state to the user stack.
* Clear set of signals caught on the signal stack.
*/
- p->p_sigstk.ss_flags = SS_DISABLE;
- p->p_sigstk.ss_size = 0;
- p->p_sigstk.ss_sp = 0;
+ sigstkinit(&p->p_sigstk);
ps->ps_flags &= ~SAS_NOCLDWAIT;
if (ps->ps_sigact[SIGCHLD] == SIG_IGN)
ps->ps_sigact[SIGCHLD] = SIG_DFL;