Source-Changes-HG archive

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

[src/netbsd-3]: src Backout revision (requested by elad in ticket #487):



details:   https://anonhg.NetBSD.org/src/rev/fe3683e3c505
branches:  netbsd-3
changeset: 576429:fe3683e3c505
user:      tron <tron%NetBSD.org@localhost>
date:      Sat Jul 02 18:50:06 2005 +0000

description:
Backout revision (requested by elad in ticket #487):
Backout systrace related changes. Only the the verified exec subsystem
fix which was accidentally committed with these changes should have been
pulled up.

diffstat:

 bin/systrace/intercept.c       |  43 ++++++++------------------
 bin/systrace/intercept.h       |   4 +-
 bin/systrace/netbsd-syscalls.c |  17 +---------
 sys/kern/exec_script.c         |  13 +------
 sys/kern/kern_exec.c           |  38 +---------------------
 sys/kern/kern_systrace.c       |  67 +++++++----------------------------------
 sys/sys/systrace.h             |   9 +-----
 7 files changed, 34 insertions(+), 157 deletions(-)

diffs (truncated from 444 to 300 lines):

diff -r c3e41003d62b -r fe3683e3c505 bin/systrace/intercept.c
--- a/bin/systrace/intercept.c  Sat Jul 02 18:13:57 2005 +0000
+++ b/bin/systrace/intercept.c  Sat Jul 02 18:50:06 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intercept.c,v 1.20.6.1 2005/07/02 17:53:51 tron Exp $  */
+/*     $NetBSD: intercept.c,v 1.20.6.2 2005/07/02 18:50:06 tron Exp $  */
 /*     $OpenBSD: intercept.c,v 1.29 2002/08/28 03:30:27 itojun Exp $   */
 /*
  * Copyright 2002 Niels Provos <provos%citi.umich.edu@localhost>
@@ -30,7 +30,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: intercept.c,v 1.20.6.1 2005/07/02 17:53:51 tron Exp $");
+__RCSID("$NetBSD: intercept.c,v 1.20.6.2 2005/07/02 18:50:06 tron Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -816,11 +816,17 @@
 
        icpid = intercept_getpid(pid);
        if (!strcmp("execve", name)) {
-               intercept_newimage(fd, pid, policynr, emulation,
-                                  icpid->newname, icpid);
-               /* we might have detached by now */
-               if (intercept_findpid(pid) == NULL)
-                       return;
+
+               /* Commit the name of the new image */
+               if (icpid->name)
+                       free(icpid->name);
+               icpid->name = icpid->newname;
+               icpid->newname = NULL;
+
+               if (intercept_newimagecb != NULL)
+                       (*intercept_newimagecb)(fd, pid, policynr, emulation,
+                           icpid->name, intercept_newimagecbarg);
+
        }
 
  out:
@@ -828,29 +834,6 @@
        intercept.answer(fd, pid, seqnr, 0, 0, 0, NULL);
 }
 
-void
-intercept_newimage(int fd, pid_t pid, int policynr, const char *emulation,
-                  char *newname, struct intercept_pid *icpid)
-{
-       if (icpid == NULL)
-               icpid = intercept_getpid(pid);
-
-       if (icpid->name)
-               free(icpid->name);
-       if ((icpid->name = strdup(newname)) == NULL)
-               err(1, "%s:%d: strdup", __func__, __LINE__);
-
-       if (icpid->newname != NULL) {
-               free(icpid->newname);
-               icpid->newname = NULL;
-       }
-
-       if (intercept_newimagecb != NULL)
-               (*intercept_newimagecb)(fd, pid, policynr, emulation,
-                   icpid->name, intercept_newimagecbarg);
-
-}
-
 int
 intercept_newpolicy(int fd)
 {
diff -r c3e41003d62b -r fe3683e3c505 bin/systrace/intercept.h
--- a/bin/systrace/intercept.h  Sat Jul 02 18:13:57 2005 +0000
+++ b/bin/systrace/intercept.h  Sat Jul 02 18:50:06 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intercept.h,v 1.13.6.1 2005/07/02 17:53:38 tron Exp $  */
+/*     $NetBSD: intercept.h,v 1.13.6.2 2005/07/02 18:50:06 tron Exp $  */
 /*     $OpenBSD: intercept.h,v 1.11 2002/08/04 04:15:50 provos Exp $   */
 /*
  * Copyright 2002 Niels Provos <provos%citi.umich.edu@localhost>
@@ -196,8 +196,6 @@
     const char *, void *, int, int, void *);
 void intercept_ugid(struct intercept_pid *, uid_t, gid_t);
 void intercept_setpid(struct intercept_pid *, uid_t, gid_t);
-void intercept_newimage(int, pid_t, int, const char *, char *,
-    struct intercept_pid *);
 
 int intercept_isvalidsystemcall(char *, char *);
 
diff -r c3e41003d62b -r fe3683e3c505 bin/systrace/netbsd-syscalls.c
--- a/bin/systrace/netbsd-syscalls.c    Sat Jul 02 18:13:57 2005 +0000
+++ b/bin/systrace/netbsd-syscalls.c    Sat Jul 02 18:50:06 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd-syscalls.c,v 1.17.2.1 2005/07/02 17:53:45 tron Exp $    */
+/*     $NetBSD: netbsd-syscalls.c,v 1.17.2.2 2005/07/02 18:50:06 tron Exp $    */
 
 /*
  * Copyright 2002 Niels Provos <provos%citi.umich.edu@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: netbsd-syscalls.c,v 1.17.2.1 2005/07/02 17:53:45 tron Exp $");
+__RCSID("$NetBSD: netbsd-syscalls.c,v 1.17.2.2 2005/07/02 18:50:06 tron Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -644,19 +644,6 @@
                intercept_policy_free(msg.msg_policy);
                break;
 #endif
-#ifdef SYSTR_MSG_EXECVE
-       case SYSTR_MSG_EXECVE: {
-               struct str_msg_execve *msg_execve = &msg.msg_data.msg_execve;
-
-               intercept_newimage(fd, pid, msg.msg_policy, current->name,
-                                  msg_execve->path, NULL);
-
-               if (nbsd_answer(fd, pid, seqnr, 0, 0, 0, NULL) == -1)
-                       err(1, "%s:%d: answer", __func__, __LINE__);
-
-               break;
-       }
-#endif /* SYSTR_MSG_EXECVE */
        }
        return (0);
 }
diff -r c3e41003d62b -r fe3683e3c505 sys/kern/exec_script.c
--- a/sys/kern/exec_script.c    Sat Jul 02 18:13:57 2005 +0000
+++ b/sys/kern/exec_script.c    Sat Jul 02 18:50:06 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_script.c,v 1.38.10.2 2005/07/02 17:53:58 tron Exp $       */
+/*     $NetBSD: exec_script.c,v 1.38.10.3 2005/07/02 18:50:06 tron Exp $       */
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.38.10.2 2005/07/02 17:53:58 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.38.10.3 2005/07/02 18:50:06 tron Exp $");
 
 #if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
 #define FDSCRIPTS              /* Need this for safe set-id scripts. */
@@ -56,10 +56,6 @@
 
 #include <sys/verified_exec.h>
 
-#ifdef SYSTRACE
-#include <sys/systrace.h>
-#endif /* SYSTRACE */
-
 /*
  * exec_script_makecmds(): Check if it's an executable shell script.
  *
@@ -229,13 +225,8 @@
        if ((epp->ep_flags & EXEC_HASFD) == 0) {
 #endif
                /* normally can't fail, but check for it if diagnostic */
-#ifdef SYSTRACE
-               error = copystr(epp->ep_name, *tmpsap++, MAXPATHLEN,
-                               (size_t *)0);
-#else
                error = copyinstr(epp->ep_name, *tmpsap++, MAXPATHLEN,
                    (size_t *)0);
-#endif /* SYSTRACE */
 #ifdef DIAGNOSTIC
                if (error != 0)
                        panic("exec_script: copyinstr couldn't fail");
diff -r c3e41003d62b -r fe3683e3c505 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Sat Jul 02 18:13:57 2005 +0000
+++ b/sys/kern/kern_exec.c      Sat Jul 02 18:50:06 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.194.4.3 2005/07/02 17:53:32 tron Exp $ */
+/*     $NetBSD: kern_exec.c,v 1.194.4.4 2005/07/02 18:50:06 tron Exp $ */
 
 /*-
  * Copyright (C) 1993, 1994, 1996 Christopher G. Demetriou
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.194.4.3 2005/07/02 17:53:32 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.194.4.4 2005/07/02 18:50:06 tron Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_syscall_debug.h"
@@ -67,10 +67,6 @@
 #include <sys/verified_exec.h>
 #endif
 
-#ifdef SYSTRACE
-#include <sys/systrace.h>
-#endif /* SYSTRACE */
-
 #include <uvm/uvm_extern.h>
 
 #include <machine/cpu.h>
@@ -393,11 +389,6 @@
        int                     szsigcode;
        struct exec_vmcmd       *base_vcp;
        int                     oldlwpflags;
-#ifdef SYSTRACE
-       int                     wassugid = ISSET(p->p_flag, P_SUGID);
-       char                    pathbuf[MAXPATHLEN];
-       size_t                  pathbuflen;
-#endif /* SYSTRACE */
 
        /* Disable scheduler activation upcalls. */
        oldlwpflags = l->l_flag & (L_SA | L_SA_UPCALL);
@@ -423,25 +414,12 @@
         * functions call check_exec() recursively - for example,
         * see exec_script_makecmds().
         */
-#ifdef SYSTRACE
-       error = copyinstr(SCARG(uap, path), pathbuf, sizeof(pathbuf),
-                         &pathbuflen);
-       if (error)
-               goto clrflg;
-
-       NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_SYSSPACE, pathbuf, p);
-#else
        NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
-#endif /* SYSTRACE */
 
        /*
         * initialize the fields of the exec package.
         */
-#ifdef SYSTRACE
-       pack.ep_name = pathbuf;
-#else
        pack.ep_name = SCARG(uap, path);
-#endif /* SYSTRACE */
        pack.ep_hdr = malloc(exec_maxhdrsz, M_EXEC, M_WAITOK);
        pack.ep_hdrlen = exec_maxhdrsz;
        pack.ep_hdrvalid = 0;
@@ -862,12 +840,6 @@
                splx(s);
        }
 
-#ifdef SYSTRACE
-       if (ISSET(p->p_flag, P_SYSTRACE) &&
-           wassugid && !ISSET(p->p_flag, P_SUGID))
-               systrace_execve(pathbuf, p);
-#endif /* SYSTRACE */
-
        return (EJUSTRETURN);
 
  bad:
@@ -887,17 +859,13 @@
        uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
 
  freehdr:
-       free(pack.ep_hdr, M_EXEC);
-
-#ifdef SYSTRACE
- clrflg:
-#endif /* SYSTRACE */
        l->l_flag |= oldlwpflags;
        p->p_flag &= ~P_INEXEC;
 #ifdef LKM
        lockmgr(&exec_lock, LK_RELEASE, NULL);
 #endif
 
+       free(pack.ep_hdr, M_EXEC);
        return error;
 
  exec_abort:
diff -r c3e41003d62b -r fe3683e3c505 sys/kern/kern_systrace.c
--- a/sys/kern/kern_systrace.c  Sat Jul 02 18:13:57 2005 +0000
+++ b/sys/kern/kern_systrace.c  Sat Jul 02 18:50:06 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_systrace.c,v 1.44.2.1 2005/07/02 17:54:05 tron Exp $      */
+/*     $NetBSD: kern_systrace.c,v 1.44.2.2 2005/07/02 18:50:06 tron Exp $      */
 
 /*
  * Copyright 2002, 2003 Niels Provos <provos%citi.umich.edu@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.44.2.1 2005/07/02 17:54:05 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.44.2.2 2005/07/02 18:50:06 tron Exp $");
 
 #include "opt_systrace.h"
 
@@ -1242,42 +1242,6 @@
        return (error);
 }
 
-void
-systrace_execve(char *path, struct proc *p)
-{
-       struct str_process *strp;
-       struct fsystrace *fst;
-       struct str_message msg;
-       struct str_msg_execve *msg_execve;
-
-       do {



Home | Main Index | Thread Index | Old Index