summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-04-10 17:32:00 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-04-10 17:32:00 +0000
commit9d9e4a4be88b906e2d0cc8f3829b16adc30fbff1 (patch)
treea7660fd6740da1977e0875ecc7008708758a66b9 /sys/kern
parentb9780a0ea9e74ce401eb965f686bed2ed8a35769 (diff)
don't attach to system processes.
art@ niklas@ markus@ millert@ deraadt@ ok.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/sys_process.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 562fe227661..2921ef101f9 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_process.c,v 1.21 2002/03/12 14:37:40 art Exp $ */
+/* $OpenBSD: sys_process.c,v 1.22 2002/04/10 17:31:59 fgsch Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
@@ -121,13 +121,19 @@ sys_ptrace(p, v, retval)
return (EINVAL);
/*
- * (2) it's already being traced, or
+ * (2) it's a system process
+ */
+ if (ISSET(t->p_flag, P_SYSTEM))
+ return (EPERM);
+
+ /*
+ * (3) it's already being traced, or
*/
if (ISSET(t->p_flag, P_TRACED))
return (EBUSY);
/*
- * (3) it's not owned by you, or the last exec
+ * (4) it's not owned by you, or the last exec
* gave us setuid/setgid privs (unless
* you're root), or...
*
@@ -143,7 +149,7 @@ sys_ptrace(p, v, retval)
return (error);
/*
- * (4) ...it's init, which controls the security level
+ * (5) ...it's init, which controls the security level
* of the entire system, and the system was not
* compiled with permanently insecure mode turned
* on.