[BACK]Return to procfs_vnops.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / miscfs / procfs

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/miscfs/procfs/procfs_vnops.c between version 1.129 and 1.130

version 1.129, 2006/02/02 00:29:24 version 1.130, 2006/05/14 21:31:53
Line 94  __KERNEL_RCSID(0, "$NetBSD$");
Line 94  __KERNEL_RCSID(0, "$NetBSD$");
 #include <sys/stat.h>  #include <sys/stat.h>
 #include <sys/ptrace.h>  #include <sys/ptrace.h>
 #include <sys/sysctl.h> /* XXX for curtain */  #include <sys/sysctl.h> /* XXX for curtain */
   #include <sys/kauth.h>
   
 #include <uvm/uvm_extern.h>     /* for PAGE_SIZE */  #include <uvm/uvm_extern.h>     /* for PAGE_SIZE */
   
Line 271  procfs_open(v)
Line 272  procfs_open(v)
         struct vop_open_args /* {          struct vop_open_args /* {
                 struct vnode *a_vp;                  struct vnode *a_vp;
                 int  a_mode;                  int  a_mode;
                 struct ucred *a_cred;                  kauth_cred_t a_cred;
                 struct lwp *a_l;                  struct lwp *a_l;
         } */ *ap = v;          } */ *ap = v;
         struct pfsnode *pfs = VTOPFS(ap->a_vp);          struct pfsnode *pfs = VTOPFS(ap->a_vp);
Line 320  procfs_close(v)
Line 321  procfs_close(v)
         struct vop_close_args /* {          struct vop_close_args /* {
                 struct vnode *a_vp;                  struct vnode *a_vp;
                 int  a_fflag;                  int  a_fflag;
                 struct ucred *a_cred;                  kauth_cred_t a_cred;
                 struct lwp *a_l;                  struct lwp *a_l;
         } */ *ap = v;          } */ *ap = v;
         struct pfsnode *pfs = VTOPFS(ap->a_vp);          struct pfsnode *pfs = VTOPFS(ap->a_vp);
Line 542  procfs_getattr(v)
Line 543  procfs_getattr(v)
         struct vop_getattr_args /* {          struct vop_getattr_args /* {
                 struct vnode *a_vp;                  struct vnode *a_vp;
                 struct vattr *a_vap;                  struct vattr *a_vap;
                 struct ucred *a_cred;                  kauth_cred_t a_cred;
                 struct lwp *a_l;                  struct lwp *a_l;
         } */ *ap = v;          } */ *ap = v;
         struct pfsnode *pfs = VTOPFS(ap->a_vp);          struct pfsnode *pfs = VTOPFS(ap->a_vp);
Line 566  procfs_getattr(v)
Line 567  procfs_getattr(v)
         }          }
   
         if (procp != NULL) {          if (procp != NULL) {
                 if (CURTAIN(curlwp->l_proc->p_ucred->cr_uid,                  if (kauth_authorize_process(curlwp->l_proc->p_cred,
                             procp->p_ucred->cr_uid))                      KAUTH_PROCESS_CANSEE, curlwp->l_proc, procp->p_cred,
                       procp, NULL) != 0)
                         return (ENOENT);                          return (ENOENT);
         }          }
   
Line 626  procfs_getattr(v)
Line 628  procfs_getattr(v)
         case PFSmaps:          case PFSmaps:
         case PFScmdline:          case PFScmdline:
                 vap->va_nlink = 1;                  vap->va_nlink = 1;
                 vap->va_uid = procp->p_ucred->cr_uid;                  vap->va_uid = kauth_cred_geteuid(procp->p_cred);
                 vap->va_gid = procp->p_ucred->cr_gid;                  vap->va_gid = kauth_cred_getegid(procp->p_cred);
                 break;                  break;
         case PFSmeminfo:          case PFSmeminfo:
         case PFScpuinfo:          case PFScpuinfo:
Line 682  procfs_getattr(v)
Line 684  procfs_getattr(v)
                                 return error;                                  return error;
                         FILE_USE(fp);                          FILE_USE(fp);
                         vap->va_nlink = 1;                          vap->va_nlink = 1;
                         vap->va_uid = fp->f_cred->cr_uid;                          vap->va_uid = kauth_cred_geteuid(fp->f_cred);
                         vap->va_gid = fp->f_cred->cr_gid;                          vap->va_gid = kauth_cred_getegid(fp->f_cred);
                         switch (fp->f_type) {                          switch (fp->f_type) {
                         case DTYPE_VNODE:                          case DTYPE_VNODE:
                                 vap->va_bytes = vap->va_size =                                  vap->va_bytes = vap->va_size =
Line 699  procfs_getattr(v)
Line 701  procfs_getattr(v)
                 /*FALLTHROUGH*/                  /*FALLTHROUGH*/
         case PFSproc:          case PFSproc:
                 vap->va_nlink = 2;                  vap->va_nlink = 2;
                 vap->va_uid = procp->p_ucred->cr_uid;                  vap->va_uid = kauth_cred_geteuid(procp->p_cred);
                 vap->va_gid = procp->p_ucred->cr_gid;                  vap->va_gid = kauth_cred_getegid(procp->p_cred);
                 vap->va_bytes = vap->va_size = DEV_BSIZE;                  vap->va_bytes = vap->va_size = DEV_BSIZE;
                 break;                  break;
   
Line 815  procfs_access(v)
Line 817  procfs_access(v)
         struct vop_access_args /* {          struct vop_access_args /* {
                 struct vnode *a_vp;                  struct vnode *a_vp;
                 int a_mode;                  int a_mode;
                 struct ucred *a_cred;                  kauth_cred_t a_cred;
                 struct lwp *a_l;                  struct lwp *a_l;
         } */ *ap = v;          } */ *ap = v;
         struct vattr va;          struct vattr va;
Line 1095  procfs_root_readdir_callback(struct proc
Line 1097  procfs_root_readdir_callback(struct proc
                 return 0;                  return 0;
         }          }
   
         if (CURTAIN(curlwp->l_proc->p_ucred->cr_uid, p->p_ucred->cr_uid))          if (CURTAIN(kauth_cred_geteuid(curlwp->l_proc->p_cred),
                       kauth_cred_geteuid(p->p_cred)))
                 return (0);                  return (0);
   
         memset(&d, 0, UIO_MX);          memset(&d, 0, UIO_MX);
Line 1140  procfs_readdir(v)
Line 1143  procfs_readdir(v)
         struct vop_readdir_args /* {          struct vop_readdir_args /* {
                 struct vnode *a_vp;                  struct vnode *a_vp;
                 struct uio *a_uio;                  struct uio *a_uio;
                 struct ucred *a_cred;                  kauth_cred_t a_cred;
                 int *a_eofflag;                  int *a_eofflag;
                 off_t **a_cookies;                  off_t **a_cookies;
                 int *a_ncookies;                  int *a_ncookies;
Line 1223  procfs_readdir(v)
Line 1226  procfs_readdir(v)
                 if (p == NULL)                  if (p == NULL)
                         return ESRCH;                          return ESRCH;
   
                 if (CURTAIN(curlwp->l_proc->p_ucred->cr_uid,                  if (CURTAIN(kauth_cred_geteuid(curlwp->l_proc->p_cred),
                             p->p_ucred->cr_uid))                              kauth_cred_geteuid(p->p_cred)))
                         return (ESRCH);                          return (ESRCH);
   
                 fdp = p->p_fd;                  fdp = p->p_fd;

Legend:
Removed from v.1.129  
changed lines
  Added in v.1.130

CVSweb <webmaster@jp.NetBSD.org>