summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1997-02-17 10:58:46 +0000
committerdg <dg@FreeBSD.org>1997-02-17 10:58:46 +0000
commit2af96e689ce0de14ee79eef20ace76145bb8112d (patch)
tree30cddd1ef6589e028945cb76d5b45b9de5a2db52 /sys/kern
parentc674b6df12228e4a70c0d923c5423a02131373d8 (diff)
downloadFreeBSD-src-2af96e689ce0de14ee79eef20ace76145bb8112d.zip
FreeBSD-src-2af96e689ce0de14ee79eef20ace76145bb8112d.tar.gz
Pass P_SUGID on to the child of a fork(). It was possible to get rlogin
to coredump previously since it (somewhat uniquely) is setuid and forks without execing, and thus without passing P_SUGID the child could coredump and possibly divulge sensitive information (such as encrypted passwords from the passwd database).
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_fork.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 0de5272..40f12f3 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -275,6 +275,10 @@ again:
p2->p_limit->p_refcnt++;
}
+ /*
+ * Preserve some flags in subprocess.
+ */
+ p2->p_flag |= p1->p_flag & P_SUGID;
if (p1->p_session->s_ttyvp != NULL && p1->p_flag & P_CONTROLT)
p2->p_flag |= P_CONTROLT;
if (flags & RFPPWAIT)
OpenPOWER on IntegriCloud