summaryrefslogtreecommitdiff
path: root/sys/kern/sys_process.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-03-09 01:34:01 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-03-09 01:34:01 +0000
commit11820976fc09e613dd88eebdd9a7e6a5b73471ab (patch)
treed61577ac6c10e2111c920e9de4535648d81c1171 /sys/kern/sys_process.c
parent5c66c78b07f34ed9acddc827ceb266aae6caeac4 (diff)
Disallow ptrace if P_SUGIDEXEC flag is set (we already disallow if P_SUGID
is set). deraadt@ and tholo@ OK.
Diffstat (limited to 'sys/kern/sys_process.c')
-rw-r--r--sys/kern/sys_process.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index e0a36f1925f..0b0549b9812 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_process.c,v 1.23 2002/06/27 02:04:50 deraadt Exp $ */
+/* $OpenBSD: sys_process.c,v 1.24 2003/03/09 01:33:59 millert Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
@@ -137,13 +137,14 @@ sys_ptrace(p, v, retval)
* gave us setuid/setgid privs (unless
* you're root), or...
*
- * [Note: once P_SUGID gets set in execve(), it stays
- * set until the process does another execve(). Hence
- * this prevents a setuid process which revokes it's
- * special privilidges using setuid() from being
- * traced. This is good security.]
+ * [Note: once P_SUGID or P_SUGIDEXEC gets set in
+ * execve(), they stay set until the process does
+ * another execve(). Hence this prevents a setuid
+ * process which revokes it's special privileges using
+ * setuid() from being traced. This is good security.]
*/
if ((t->p_cred->p_ruid != p->p_cred->p_ruid ||
+ ISSET(t->p_flag, P_SUGIDEXEC) ||
ISSET(t->p_flag, P_SUGID)) &&
(error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);