summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_process.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2002-01-20 11:27:52 +0000
committerart <art@openbsd.org>2002-01-20 11:27:52 +0000
commitd5f75ac068d4a0953207b975601aab0d6386eb43 (patch)
treed9fedd09638886ec4c421aaa61a42e5373f961d0 /sys/kern/sys_process.c
parentfix quite appearent bug in cpu_swapin(), missing '&' can easily corrupt (diff)
downloadwireguard-openbsd-d5f75ac068d4a0953207b975601aab0d6386eb43.tar.xz
wireguard-openbsd-d5f75ac068d4a0953207b975601aab0d6386eb43.zip
When a process is exec:ing mark it with a flag. Check that flag in ptrace
and procfs (and possibly more places in the future) and simply refuse to fiddle with the execing process. This is an ugly hack, but this far we haven't been successful in creating a race-free exec.
Diffstat (limited to 'sys/kern/sys_process.c')
-rw-r--r--sys/kern/sys_process.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index e20fedf045d..2e27b3d46ea 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_process.c,v 1.15 2002/01/02 02:38:42 art Exp $ */
+/* $OpenBSD: sys_process.c,v 1.16 2002/01/20 11:27:52 art Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
@@ -107,6 +107,9 @@ sys_ptrace(p, v, retval)
return (ESRCH);
}
+ if ((t->p_flag & P_INEXEC) != 0)
+ return (EAGAIN);
+
/* Make sure we can operate on it. */
switch (SCARG(uap, req)) {
case PT_TRACE_ME: