diff options
| author | christos <christos@NetBSD.org> | 2002-01-11 21:16:27 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2002-01-11 21:16:27 +0000 |
| commit | d4e7e4c9c46b73dc49ea2bba07f79c9dcaf04ab2 (patch) | |
| tree | 23e8cc1b8efd86e1670941c32a10838c8f53c549 /sys/kern/sys_process.c | |
| parent | 94faea123bc369a6a06405eb4a3bf094ec1ba71d (diff) | |
Fix a ptrace/execve race that could be used to modify the child process's
image during execve. This is a security issue because one can
do that to setuid programs... From FreeBSD.
Diffstat (limited to 'sys/kern/sys_process.c')
| -rw-r--r-- | sys/kern/sys_process.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index c74fc5a1a58..78c56f44208 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_process.c,v 1.71 2001/12/05 00:58:05 thorpej Exp $ */ +/* $NetBSD: sys_process.c,v 1.72 2002/01/11 21:16:28 christos Exp $ */ /*- * Copyright (c) 1994 Christopher G. Demetriou. All rights reserved. @@ -53,7 +53,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.71 2001/12/05 00:58:05 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.72 2002/01/11 21:16:28 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -107,6 +107,10 @@ sys_ptrace(p, v, retval) return (ESRCH); } + /* Can't trace a process that's currently exec'ing. */ + if ((t->p_flag & P_INEXEC) != 0) + return EAGAIN; + /* Make sure we can operate on it. */ switch (SCARG(uap, req)) { case PT_TRACE_ME: |
