Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/procfs Implement curtain for procfs.



details:   https://anonhg.NetBSD.org/src/rev/890753b513e6
branches:  trunk
changeset: 584221:890753b513e6
user:      elad <elad%NetBSD.org@localhost>
date:      Sun Sep 11 20:15:53 2005 +0000

description:
Implement curtain for procfs.

diffstat:

 sys/miscfs/procfs/procfs_vnops.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r 1a95a9dee0c3 -r 890753b513e6 sys/miscfs/procfs/procfs_vnops.c
--- a/sys/miscfs/procfs/procfs_vnops.c  Sun Sep 11 17:55:56 2005 +0000
+++ b/sys/miscfs/procfs/procfs_vnops.c  Sun Sep 11 20:15:53 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_vnops.c,v 1.124 2005/08/30 20:08:01 xtraeme Exp $       */
+/*     $NetBSD: procfs_vnops.c,v 1.125 2005/09/11 20:15:53 elad Exp $  */
 
 /*
  * Copyright (c) 1993, 1995
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.124 2005/08/30 20:08:01 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.125 2005/09/11 20:15:53 elad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,6 +93,7 @@
 #include <sys/resourcevar.h>
 #include <sys/stat.h>
 #include <sys/ptrace.h>
+#include <sys/sysctl.h> /* XXX for curtain */
 
 #include <uvm/uvm_extern.h>    /* for PAGE_SIZE */
 
@@ -525,6 +526,12 @@
                break;
        }
 
+       if (procp != NULL) {
+               if (CURTAIN(curlwp->l_proc->p_ucred->cr_uid,
+                           procp->p_ucred->cr_uid))
+                       return (ENOENT);
+       }
+
        error = 0;
 
        /* start by zeroing out the attributes */
@@ -1028,6 +1035,9 @@
                return 0;
        }
 
+       if (CURTAIN(curlwp->l_proc->p_ucred->cr_uid, p->p_ucred->cr_uid))
+               return (0);
+
        memset(&d, 0, UIO_MX);
        d.d_reclen = UIO_MX;
        d.d_fileno = PROCFS_FILENO(p->p_pid, PFSproc, -1);
@@ -1153,6 +1163,10 @@
                if (p == NULL)
                        return ESRCH;
 
+               if (CURTAIN(curlwp->l_proc->p_ucred->cr_uid,
+                           p->p_ucred->cr_uid))
+                       return (ESRCH);
+
                fdp = p->p_fd;
 
                lim = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, maxfiles);



Home | Main Index | Thread Index | Old Index