Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/miscfs/procfs Apply the same P_INEXEC test to avoid the ...



details:   https://anonhg.NetBSD.org/src/rev/4b1355a29c38
branches:  trunk
changeset: 520453:4b1355a29c38
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 11 22:02:56 2002 +0000

description:
Apply the same P_INEXEC test to avoid the execve/trace problem using
the procfs ptrace calls.

diffstat:

 sys/miscfs/procfs/procfs_ctl.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 00b09247775b -r 4b1355a29c38 sys/miscfs/procfs/procfs_ctl.c
--- a/sys/miscfs/procfs/procfs_ctl.c    Fri Jan 11 21:17:30 2002 +0000
+++ b/sys/miscfs/procfs/procfs_ctl.c    Fri Jan 11 22:02:56 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_ctl.c,v 1.21 2001/12/05 00:58:05 thorpej Exp $  */
+/*     $NetBSD: procfs_ctl.c,v 1.22 2002/01/11 22:02:56 christos Exp $ */
 
 /*
  * Copyright (c) 1993 Jan-Simon Pendry
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_ctl.c,v 1.21 2001/12/05 00:58:05 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_ctl.c,v 1.22 2002/01/11 22:02:56 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -108,10 +108,16 @@
        int s, error;
 
        /*
+        * You cannot do anything to the process if it is currently exec'ing
+        */
+       if (ISSET(p->p_flag, P_INEXEC))
+               return (EAGAIN);
+
+       switch (op) {
+       /*
         * Attach - attaches the target process for debugging
         * by the calling process.
         */
-       switch (op) {
        case PROCFS_CTL_ATTACH:
                /* 
                 * You can't attach to a process if:



Home | Main Index | Thread Index | Old Index