From c87e2930e6a89e4e7b33b4a6eff43fffe1f3fa73 Mon Sep 17 00:00:00 2001 From: David Greenman Date: Sun, 28 Jun 1998 08:37:45 +0000 Subject: [PATCH] Added a sysctl variable kern.sugid_coredump for controlling coredump behavior of setuid/setgid binaries that defaults to 0 (coredump disabled). --- sys/kern/kern_sig.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 9026fb2a579..da793283b6e 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94 - * $Id: kern_sig.c,v 1.40 1998/03/03 20:55:26 tegge Exp $ + * $Id: kern_sig.c,v 1.41 1998/06/07 17:11:35 dfr Exp $ */ #include "opt_compat.h" @@ -44,6 +44,7 @@ #define SIGPROP /* include signal properties table */ #include +#include #include #include #include @@ -59,6 +60,7 @@ #include #include #include +#include #include #ifdef SMP @@ -89,6 +91,9 @@ static void stop __P((struct proc *)); (pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid || \ ((signum) == SIGCONT && (q)->p_session == (p)->p_session)) +static int sugid_coredump; +SYSCTL_INT(_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW, &sugid_coredump, 0, ""); + #ifndef _SYS_SYSPROTO_H_ struct sigaction_args { int signum; @@ -1259,7 +1264,7 @@ coredump(p) STOPEVENT(p, S_CORE, 0); - if (p->p_flag & P_SUGID) + if (sugid_coredump == 0 && p->p_flag & P_SUGID) return (EFAULT); if (ctob(UPAGES + vm->vm_dsize + vm->vm_ssize) >= p->p_rlimit[RLIMIT_CORE].rlim_cur)