diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-03 05:01:46 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-03 05:01:46 +0000 |
commit | 7e024cb24ec42e3b08014203736727223858b2c0 (patch) | |
tree | 8d8640d545b892af68ce7d1b4660652b26517209 | |
parent | c450a33e15c47f152f66306bf404bf56eb906879 (diff) |
do not coredump for setuid/setgid, unless run by root
-rw-r--r-- | sys/kern/kern_sig.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 387bea938d8..d673ad8c5f8 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.4 1996/05/02 13:12:13 deraadt Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.5 1996/09/03 05:01:45 deraadt Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1055,8 +1055,12 @@ coredump(p) char name[MAXCOMLEN+6]; /* progname.core */ struct core core; - if (pcred->p_svuid != pcred->p_ruid || pcred->p_svgid != pcred->p_rgid) - return (EFAULT); + if (!(pcred->p_svuid == pcred->p_ruid && pcred->p_ruid == 0) && + (pcred->p_svuid != pcred->p_ruid || + cred->cr_uid != pcred->p_ruid || + pcred->p_svgid != pcred->p_rgid || + cred->cr_gid != pcred->p_rgid) + return (EFAULT); if (USPACE + ctob(vm->vm_dsize + vm->vm_ssize) >= p->p_rlimit[RLIMIT_CORE].rlim_cur) return (EFAULT); |