summaryrefslogtreecommitdiff
path: root/sys/miscfs
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-01-20 11:27:53 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-01-20 11:27:53 +0000
commitb1debdf727116f16170aa85959010013dd34583e (patch)
treeb2f6cee252eb75c2e5b8874177dcccb398a63941 /sys/miscfs
parent5553da18201980ea91c0445a3120d60334ec5ae5 (diff)
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/miscfs')
-rw-r--r--sys/miscfs/procfs/procfs_mem.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/miscfs/procfs/procfs_mem.c b/sys/miscfs/procfs/procfs_mem.c
index 57c121a0f9d..afa929c1f7a 100644
--- a/sys/miscfs/procfs/procfs_mem.c
+++ b/sys/miscfs/procfs/procfs_mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_mem.c,v 1.15 2001/11/06 01:44:23 art Exp $ */
+/* $OpenBSD: procfs_mem.c,v 1.16 2002/01/20 11:27:52 art Exp $ */
/* $NetBSD: procfs_mem.c,v 1.8 1996/02/09 22:40:50 christos Exp $ */
/*
@@ -104,6 +104,8 @@ procfs_domem(curp, p, pfs, uio)
* of the entire system, and the system was not
* compiled with permanently insecure mode turned
* on.
+ *
+ * (3) It's currently execing.
*/
int
procfs_checkioperm(p, t)
@@ -119,6 +121,9 @@ procfs_checkioperm(p, t)
if ((t->p_pid == 1) && (securelevel > -1))
return (EPERM);
+ if (t->p_flag & P_INEXEC)
+ return (EAGAIN);
+
return (0);
}