From bc97d70b104321c37625720fd106238186cb9029 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 29 Aug 1997 04:24:39 +0000 Subject: From NetBSD (thorpej): Fix a reversed argument which caused procfs_checkioperm() to always return OK". Add a few comments to avoid further confusion. --- sys/miscfs/procfs/procfs.h | 4 ++-- sys/miscfs/procfs/procfs_ctl.c | 6 +++--- sys/miscfs/procfs/procfs_fpregs.c | 6 +++--- sys/miscfs/procfs/procfs_mem.c | 19 ++++++++++++------- sys/miscfs/procfs/procfs_regs.c | 6 +++--- sys/miscfs/procfs/procfs_vnops.c | 6 +++--- 6 files changed, 26 insertions(+), 21 deletions(-) (limited to 'sys/miscfs') diff --git a/sys/miscfs/procfs/procfs.h b/sys/miscfs/procfs/procfs.h index a312f7abd47..c33203b1666 100644 --- a/sys/miscfs/procfs/procfs.h +++ b/sys/miscfs/procfs/procfs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs.h,v 1.4 1997/08/16 02:00:47 millert Exp $ */ +/* $OpenBSD: procfs.h,v 1.5 1997/08/29 04:24:36 millert Exp $ */ /* $NetBSD: procfs.h,v 1.17 1996/02/12 15:01:41 christos Exp $ */ /* @@ -105,7 +105,7 @@ vfs_namemap_t *vfs_findname __P((vfs_namemap_t *, char *, int)); #define PFIND(pid) ((pid) ? pfind(pid) : &proc0) int procfs_allocvp __P((struct mount *, struct vnode **, long, pfstype)); -int procfs_checkioperm __P((struct proc *t, struct proc *p)); +int procfs_checkioperm __P((struct proc *p, struct proc *t)); int procfs_doctl __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); int procfs_dofpregs __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); int procfs_domem __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); diff --git a/sys/miscfs/procfs/procfs_ctl.c b/sys/miscfs/procfs/procfs_ctl.c index 559ccd1e17d..5b2d9ab50d0 100644 --- a/sys/miscfs/procfs/procfs_ctl.c +++ b/sys/miscfs/procfs/procfs_ctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_ctl.c,v 1.6 1997/08/16 02:00:48 millert Exp $ */ +/* $OpenBSD: procfs_ctl.c,v 1.7 1997/08/29 04:24:37 millert Exp $ */ /* $NetBSD: procfs_ctl.c,v 1.14 1996/02/09 22:40:48 christos Exp $ */ /* @@ -109,8 +109,8 @@ static int procfs_control __P((struct proc *, struct proc *, int)); static int procfs_control(curp, p, op) - struct proc *curp; - struct proc *p; + struct proc *curp; /* tracer */ + struct proc *p; /* traced */ int op; { int error; diff --git a/sys/miscfs/procfs/procfs_fpregs.c b/sys/miscfs/procfs/procfs_fpregs.c index d6c3c84c5db..233d69cb820 100644 --- a/sys/miscfs/procfs/procfs_fpregs.c +++ b/sys/miscfs/procfs/procfs_fpregs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_fpregs.c,v 1.3 1997/08/16 02:00:48 millert Exp $ */ +/* $OpenBSD: procfs_fpregs.c,v 1.4 1997/08/29 04:24:37 millert Exp $ */ /* $NetBSD: procfs_fpregs.c,v 1.4 1995/08/13 09:06:05 mycroft Exp $ */ /* @@ -52,8 +52,8 @@ int procfs_dofpregs(curp, p, pfs, uio) - struct proc *curp; - struct proc *p; + struct proc *curp; /* tracer */ + struct proc *p; /* traced */ struct pfsnode *pfs; struct uio *uio; { diff --git a/sys/miscfs/procfs/procfs_mem.c b/sys/miscfs/procfs/procfs_mem.c index 00755c7f46c..5d069511fe2 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.5 1997/08/16 02:00:49 millert Exp $ */ +/* $OpenBSD: procfs_mem.c,v 1.6 1997/08/29 04:24:38 millert Exp $ */ /* $NetBSD: procfs_mem.c,v 1.8 1996/02/09 22:40:50 christos Exp $ */ /* @@ -208,8 +208,8 @@ procfs_rwmem(p, uio) */ int procfs_domem(curp, p, pfs, uio) - struct proc *curp; - struct proc *p; + struct proc *curp; /* tracer */ + struct proc *p; /* traced */ struct pfsnode *pfs; struct uio *uio; { @@ -244,20 +244,25 @@ procfs_findtextvp(p) } /* + * Ensure that a process has permission to perform I/O on another. + * Arguments: + * p The process wishing to do the I/O (the tracer). + * t The process who's memory/registers will be read/written. + * * You cannot attach to a process's mem/regs if: * - * (1) it's not owned by you, or the last exec + * (1) It's not owned by you, or the last exec * gave us setuid/setgid privs (unless * you're root), or... * - * (2) ...it's init, which controls the security level + * (2) It's init, which controls the security level * of the entire system, and the system was not * compiled with permanently insecure mode turned * on. */ int -procfs_checkioperm(t, p) - struct proc *t, *p; +procfs_checkioperm(p, t) + struct proc *p, *t; { int error; diff --git a/sys/miscfs/procfs/procfs_regs.c b/sys/miscfs/procfs/procfs_regs.c index faf294d67f4..ab86dd7b1ec 100644 --- a/sys/miscfs/procfs/procfs_regs.c +++ b/sys/miscfs/procfs/procfs_regs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_regs.c,v 1.3 1997/08/16 02:00:49 millert Exp $ */ +/* $OpenBSD: procfs_regs.c,v 1.4 1997/08/29 04:24:38 millert Exp $ */ /* $NetBSD: procfs_regs.c,v 1.9 1995/08/13 09:06:07 mycroft Exp $ */ /* @@ -52,8 +52,8 @@ int procfs_doregs(curp, p, pfs, uio) - struct proc *curp; - struct proc *p; + struct proc *curp; /* tracer */ + struct proc *p; /* traced */ struct pfsnode *pfs; struct uio *uio; { diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index d125626df43..281b301b8d8 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vnops.c,v 1.5 1997/08/16 02:00:50 millert Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.6 1997/08/29 04:24:38 millert Exp $ */ /* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */ /* @@ -217,8 +217,8 @@ procfs_open(v) struct proc *a_p; } */ *ap = v; struct pfsnode *pfs = VTOPFS(ap->a_vp); - struct proc *p1 = ap->a_p; - struct proc *p2; + struct proc *p1 = ap->a_p; /* tracer */ + struct proc *p2; /* traced */ int error; if ((p2 = PFIND(pfs->pfs_pid)) == 0) -- cgit v1.2.3