summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorknu <knu@FreeBSD.org>2001-05-07 18:07:29 +0000
committerknu <knu@FreeBSD.org>2001-05-07 18:07:29 +0000
commitfa8314227c51816057f11e1672444bbae7baed35 (patch)
tree9e378daa5d9b1952f2899a84d55c20c4b1faaf26 /sys/kern
parent04a6a52217ab308220e97946befc2943eb93f68c (diff)
downloadFreeBSD-src-fa8314227c51816057f11e1672444bbae7baed35.zip
FreeBSD-src-fa8314227c51816057f11e1672444bbae7baed35.tar.gz
Properly copy the P_ALTSTACK flag in struct proc::p_flag to the child
process on fork(2). It is the supposed behavior stated in the manpage of sigaction(2), and Solaris, NetBSD and FreeBSD 3-STABLE correctly do so. The previous fix against libc_r/uthread/uthread_fork.c fixed the problem only for the programs linked with libc_r, so back it out and fix fork(2) itself to help those not linked with libc_r as well. PR: kern/26705 Submitted by: KUROSAWA Takahiro <fwkg7679@mb.infoweb.ne.jp> Tested by: knu, GOTOU Yuuzou <gotoyuzo@notwork.org>, and some other people Not objected by: hackers MFC in: 3 days
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_fork.c2
-rw-r--r--sys/kern/kern_sig.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index c9539bb..d3b991d 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -495,7 +495,7 @@ again:
* Preserve some more flags in subprocess. PS_PROFIL has already
* been preserved.
*/
- p2->p_flag |= p1->p_flag & P_SUGID;
+ p2->p_flag |= p1->p_flag & (P_SUGID | P_ALTSTACK);
if (p1->p_session->s_ttyvp != NULL && p1->p_flag & P_CONTROLT)
p2->p_flag |= P_CONTROLT;
if (flags & RFPPWAIT)
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index c57074a..55da023 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -464,6 +464,7 @@ execsigs(p)
p->p_sigstk.ss_flags = SS_DISABLE;
p->p_sigstk.ss_size = 0;
p->p_sigstk.ss_sp = 0;
+ p->p_flag &= ~P_ALTSTACK;
/*
* Reset no zombies if child dies flag as Solaris does.
*/
OpenPOWER on IntegriCloud