Source-Changes-HG archive

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

[src/trunk]: src/sys Catch up with ktrace-lwp merge.



details:   https://anonhg.NetBSD.org/src/rev/d611e74e2d12
branches:  trunk
changeset: 586276:d611e74e2d12
user:      elad <elad%NetBSD.org@localhost>
date:      Mon Dec 12 16:26:33 2005 +0000

description:
Catch up with ktrace-lwp merge.

While I'm here, stop using cur{lwp,proc}.

diffstat:

 sys/dev/verified_exec.c      |  16 ++++++------
 sys/kern/kern_verifiedexec.c |  57 +++++++++++++++++++++----------------------
 sys/kern/vfs_syscalls.c      |   8 +++---
 sys/kern/vfs_vnops.c         |   6 ++--
 sys/sys/verified_exec.h      |  23 +++++++++--------
 5 files changed, 55 insertions(+), 55 deletions(-)

diffs (truncated from 400 to 300 lines):

diff -r 3fbcd84af5a3 -r d611e74e2d12 sys/dev/verified_exec.c
--- a/sys/dev/verified_exec.c   Mon Dec 12 15:04:50 2005 +0000
+++ b/sys/dev/verified_exec.c   Mon Dec 12 16:26:33 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: verified_exec.c,v 1.29 2005/12/11 12:20:53 christos Exp $      */
+/*     $NetBSD: verified_exec.c,v 1.30 2005/12/12 16:26:33 elad Exp $  */
 
 /*-
  * Copyright 2005 Elad Efrat <elad%bsd.org.il@localhost>
@@ -31,9 +31,9 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__KERNEL_RCSID(0, "$NetBSD: verified_exec.c,v 1.29 2005/12/11 12:20:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: verified_exec.c,v 1.30 2005/12/12 16:26:33 elad Exp $");
 #else
-__RCSID("$Id: verified_exec.c,v 1.29 2005/12/11 12:20:53 christos Exp $\n$NetBSD: verified_exec.c,v 1.29 2005/12/11 12:20:53 christos Exp $");
+__RCSID("$Id: verified_exec.c,v 1.30 2005/12/12 16:26:33 elad Exp $\n$NetBSD: verified_exec.c,v 1.30 2005/12/12 16:26:33 elad Exp $");
 #endif
 
 #include <sys/param.h>
@@ -145,7 +145,7 @@
 
 int
 veriexecclose(dev_t dev __unused, int flags __unused,
-                 int fmt __unused, struct proc *p __unused)
+                 int fmt __unused, struct lwp *l __unused)
 {
        if (veriexec_dev_usage > 0)
                veriexec_dev_usage--;
@@ -172,7 +172,7 @@
                break;
 
        case VERIEXEC_LOAD:
-               error = veriexec_load((struct veriexec_params *)data, p);
+               error = veriexec_load((struct veriexec_params *)data, l);
                break;
 
        case VERIEXEC_DELETE:
@@ -233,7 +233,7 @@
 }
 
 int
-veriexec_load(struct veriexec_params *params, struct proc *p)
+veriexec_load(struct veriexec_params *params, struct lwp *l)
 {
        struct veriexec_hashtbl *tbl;
        struct veriexec_hash_entry *hh;
@@ -242,7 +242,7 @@
        struct vattr va;
        int error;
 
-       NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, params->file, p);
+       NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, params->file, l);
        error = namei(&nid);
        if (error)
                return (error);
@@ -256,7 +256,7 @@
        }
 
        /* Get attributes for device and inode. */
-       error = VOP_GETATTR(nid.ni_vp, &va, p->p_ucred, p);
+       error = VOP_GETATTR(nid.ni_vp, &va, l->l_proc->p_ucred, l);
        if (error)
                return (error);
 
diff -r 3fbcd84af5a3 -r d611e74e2d12 sys/kern/kern_verifiedexec.c
--- a/sys/kern/kern_verifiedexec.c      Mon Dec 12 15:04:50 2005 +0000
+++ b/sys/kern/kern_verifiedexec.c      Mon Dec 12 16:26:33 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_verifiedexec.c,v 1.47 2005/12/08 22:41:45 yamt Exp $      */
+/*     $NetBSD: kern_verifiedexec.c,v 1.48 2005/12/12 16:26:33 elad Exp $      */
 
 /*-
  * Copyright 2005 Elad Efrat <elad%bsd.org.il@localhost>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.47 2005/12/08 22:41:45 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.48 2005/12/12 16:26:33 elad Exp $");
 
 #include "opt_verified_exec.h"
 
@@ -207,7 +207,7 @@
  * extracted from veriexec_hash_list according to the hash type.
  */
 int
-veriexec_fp_calc(struct proc *p, struct vnode *vp,
+veriexec_fp_calc(struct lwp *l, struct vnode *vp,
                 struct veriexec_hash_entry *vhe, uint64_t size, u_char *fp)
 {
        void *ctx, *page_ctx;
@@ -259,7 +259,7 @@
 #else
                                0,
 #endif
-                               p->p_ucred, &resid, NULL);
+                               l->l_proc->p_ucred, &resid, NULL);
 
                if (error) {
                        if (do_perpage) {
@@ -403,7 +403,7 @@
  * vn_open(), 'flag' will be VERIEXEC_FILE.
  */
 int
-veriexec_verify(struct proc *p, struct vnode *vp, struct vattr *va,
+veriexec_verify(struct lwp *l, struct vnode *vp, struct vattr *va,
                const u_char *name, int flag, struct veriexec_hash_entry **ret)
 {
        struct veriexec_hash_entry *vhe;
@@ -428,7 +428,7 @@
                /* Calculate fingerprint for on-disk file. */
                digest = (u_char *) malloc(vhe->ops->hash_len, M_TEMP,
                                           M_WAITOK);
-               error = veriexec_fp_calc(p, vp, vhe, va->va_size, digest);
+               error = veriexec_fp_calc(l, vp, vhe, va->va_size, digest);
                if (error) {
                        veriexec_report("Fingerprint calculation error.",
                                        name, va, NULL, REPORT_NOVERBOSE,
@@ -448,7 +448,7 @@
        }
 
        if (!(vhe->type & flag)) {
-               veriexec_report("Incorrect access type.", name, va, p,
+               veriexec_report("Incorrect access type.", name, va, l,
                                REPORT_NOVERBOSE, REPORT_ALARM,
                                REPORT_NOPANIC);
 
@@ -461,7 +461,7 @@
        /* No entry in the veriexec tables. */
        if (vhe == NULL) {
                veriexec_report("veriexec_verify: No entry.", name, va,
-                   p, REPORT_VERBOSE, REPORT_NOALARM, REPORT_NOPANIC);
+                   l, REPORT_VERBOSE, REPORT_NOALARM, REPORT_NOPANIC);
 
                /* Lockdown mode: Deny access to non-monitored files. */
                if (veriexec_strict >= 3)
@@ -513,7 +513,7 @@
  */
 int
 veriexec_page_verify(struct veriexec_hash_entry *vhe, struct vattr *va,
-                    struct vm_page *pg, size_t idx)
+                    struct vm_page *pg, size_t idx, struct lwp *l)
 {
        void *ctx;
        u_char *fp;
@@ -556,7 +556,6 @@
 
        error = veriexec_fp_cmp(vhe->ops, page_fp, fp);
        if (error) {
-               struct proc *p;
                const char *msg;
 
                if (veriexec_strict > 0) {
@@ -566,8 +565,7 @@
                        error = 0;
                }
 
-               p = curlwp->l_proc;
-               veriexec_report(msg, "[page_in]", va, p, REPORT_NOVERBOSE,
+               veriexec_report(msg, "[page_in]", va, l, REPORT_NOVERBOSE,
                                REPORT_ALARM, REPORT_NOPANIC);
 
                if (error) {
@@ -576,10 +574,10 @@
                        KSI_INIT(&ksi);
                        ksi.ksi_signo = SIGKILL;
                        ksi.ksi_code = SI_NOINFO;
-                       ksi.ksi_pid = p->p_pid;
+                       ksi.ksi_pid = l->l_proc->p_pid;
                        ksi.ksi_uid = 0;
 
-                       kpsignal(p, &ksi, NULL);
+                       kpsignal(l->l_proc, &ksi, NULL);
                }
        }
 
@@ -594,14 +592,14 @@
  * Veriexec remove policy code.
  */
 int
-veriexec_removechk(struct proc *p, struct vnode *vp, const char *pathbuf)
+veriexec_removechk(struct lwp *l, struct vnode *vp, const char *pathbuf)
 {
        struct veriexec_hashtbl *tbl;
        struct veriexec_hash_entry *vhe;
        struct vattr va;
        int error;
 
-       error = VOP_GETATTR(vp, &va, p->p_ucred, p);
+       error = VOP_GETATTR(vp, &va, l->l_proc->p_ucred, l);
        if (error)
                return (error);
 
@@ -614,7 +612,7 @@
                return (0);
        }
 
-       veriexec_report("Remove request.", pathbuf, &va, p,
+       veriexec_report("Remove request.", pathbuf, &va, l,
                        REPORT_NOVERBOSE, REPORT_ALARM, REPORT_NOPANIC);
 
        /* IPS mode: Deny removal of monitored files. */
@@ -644,15 +642,14 @@
  * Veriexe rename policy.
  */
 int
-veriexec_renamechk(struct vnode *vp, const char *from, const char *to)
+veriexec_renamechk(struct vnode *vp, const char *from, const char *to,
+                  struct lwp *l)
 {
-       struct proc *p;
        struct veriexec_hash_entry *vhe;
        struct vattr va;
        int error;
 
-       p = curlwp->l_proc;
-       error = VOP_GETATTR(vp, &va, p->p_ucred, p);
+       error = VOP_GETATTR(vp, &va, l->l_proc->p_ucred, l);
        if (error)
                return (error);
 
@@ -661,11 +658,11 @@
                       "of \"%s\" [%ld:%llu] to \"%s\", uid=%u, pid=%u: "
                       "Lockdown mode.\n", from, va.va_fsid,
                       (unsigned long long)va.va_fileid,
-                      to, p->p_ucred->cr_uid, p->p_pid);
+                      to, l->l_proc->p_ucred->cr_uid, l->l_proc->p_pid);
                return (EPERM);
        }
 
-       vhe = veriexec_lookup((dev_t)va.va_fsid, (ino_t)va.va_fileid);
+       vhe = veriexec_lookup(va.va_fsid, va.va_fileid);
        if (vhe != NULL) {
                if (veriexec_strict >= 2) {
                        printf("Veriexec: veriexec_renamechk: Preventing "
@@ -673,14 +670,15 @@
                               "uid=%u, pid=%u: IPS mode, file "
                               "monitored.\n", from, va.va_fsid,
                               (unsigned long long)va.va_fileid,
-                              to, p->p_ucred->cr_uid, p->p_pid);
+                              to, l->l_proc->p_ucred->cr_uid,
+                              l->l_proc->p_pid);
                        return (EPERM);
                }
 
                printf("Veriexec: veriexec_rename: Monitored file \"%s\" "
                       "[%ld:%llu] renamed to \"%s\", uid=%u, pid=%u.\n",
                       from, va.va_fsid, (unsigned long long)va.va_fileid, to,
-                      p->p_ucred->cr_uid, p->p_pid);
+                      l->l_proc->p_ucred->cr_uid, l->l_proc->p_pid);
        }
 
        return (0);
@@ -698,7 +696,7 @@
  */
 void
 veriexec_report(const u_char *msg, const u_char *filename,
-               struct vattr *va, struct proc *p, int verbose, int alarm,
+               struct vattr *va, struct lwp *l, int verbose, int alarm,
                int die)
 {
        void (*f)(const char *, ...);
@@ -712,14 +710,15 @@
                f = (void (*)(const char *, ...)) printf;
 
        if (!verbose || (verbose <= veriexec_verbose)) {
-               if (!alarm || p == NULL)
+               if (!alarm || l == NULL)
                        f("veriexec: %s [%s, %ld:%" PRIu64 "%s", msg, filename,
                            va->va_fsid, va->va_fileid,
                            die ? "]" : "]\n");
                else
                        f("veriexec: %s [%s, %ld:%" PRIu64 ", pid=%u, uid=%u, "
                            "gid=%u%s", msg, filename, va->va_fsid,
-                           va->va_fileid, p->p_pid, p->p_cred->p_ruid,
-                           p->p_cred->p_rgid, die ? "]" : "]\n");
+                           va->va_fileid, l->l_proc->p_pid,
+                           l->l_proc->p_cred->p_ruid,
+                           l->l_proc->p_cred->p_rgid, die ? "]" : "]\n");
        }
 }
diff -r 3fbcd84af5a3 -r d611e74e2d12 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Mon Dec 12 15:04:50 2005 +0000
+++ b/sys/kern/vfs_syscalls.c   Mon Dec 12 16:26:33 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.234 2005/12/11 12:24:30 christos Exp $      */
+/*     $NetBSD: vfs_syscalls.c,v 1.235 2005/12/12 16:26:33 elad Exp $  */
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.234 2005/12/11 12:24:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.235 2005/12/12 16:26:33 elad Exp $");
 
 #include "opt_compat_netbsd.h"



Home | Main Index | Thread Index | Old Index