From a44328353d77478090647ec991756c53a071ee35 Mon Sep 17 00:00:00 2001 From: bluhm Date: Sun, 10 Aug 2014 23:44:20 +0000 Subject: [PATCH] Write the core file of a non-suid process into the current directory even if sysctl kern.nosuidcoredump has been set to 2 or 3. This allows a regular user to debug his programs again. OK guenther@ deraadt@ --- sys/kern/kern_sig.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 88a8865d1a9..3be60832a5f 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.173 2014/07/13 16:41:21 claudio Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.174 2014/08/10 23:44:20 bluhm Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1481,14 +1481,14 @@ coredump(struct proc *p) p->p_rlimit[RLIMIT_CORE].rlim_cur) return (EFBIG); - if (nosuidcoredump == 3) { + if (incrash && nosuidcoredump == 3) { /* * If the program directory does not exist, dumps of * that core will silently fail. */ len = snprintf(name, sizeof(name), "%s/%s/%u.core", dir, p->p_comm, p->p_pid); - } else if (nosuidcoredump == 2) + } else if (incrash && nosuidcoredump == 2) len = snprintf(name, sizeof(name), "%s/%s.core", dir, p->p_comm); else -- 2.20.1