Author: mjg
Date: Wed Aug  5 09:27:03 2020
New Revision: 363893
URL: https://svnweb.freebsd.org/changeset/base/363893

Log:
  vfs: remove the obsolete privused argument from vaccess
  
  This brings argument count down to 6, which is passable without the
  stack on amd64.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/fs/cd9660/cd9660_vnops.c
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/fuse/fuse_internal.c
  head/sys/fs/msdosfs/msdosfs_vnops.c
  head/sys/fs/nfsclient/nfs_clvnops.c
  head/sys/fs/pseudofs/pseudofs_vnops.c
  head/sys/fs/smbfs/smbfs_vnops.c
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/fs/udf/udf_vnops.c
  head/sys/kern/subr_acl_nfs4.c
  head/sys/kern/subr_acl_posix1e.c
  head/sys/kern/uipc_mqueue.c
  head/sys/kern/uipc_sem.c
  head/sys/kern/uipc_shm.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/vnode.h
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c     Wed Aug 
 5 09:25:59 2020        (r363892)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c     Wed Aug 
 5 09:27:03 2020        (r363893)
@@ -4941,7 +4941,7 @@ zfs_freebsd_access(ap)
                accmode = ap->a_accmode & ~(VREAD|VWRITE|VEXEC|VAPPEND);
                if (accmode != 0) {
                        error = vaccess(vp->v_type, zp->z_mode, zp->z_uid,
-                           zp->z_gid, accmode, ap->a_cred, NULL);
+                           zp->z_gid, accmode, ap->a_cred);
                }
        }
 

Modified: head/sys/fs/cd9660/cd9660_vnops.c
==============================================================================
--- head/sys/fs/cd9660/cd9660_vnops.c   Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/fs/cd9660/cd9660_vnops.c   Wed Aug  5 09:27:03 2020        
(r363893)
@@ -158,7 +158,7 @@ cd9660_access(ap)
        }
 
        return (vaccess(vp->v_type, ip->inode.iso_mode, ip->inode.iso_uid,
-           ip->inode.iso_gid, ap->a_accmode, ap->a_cred, NULL));
+           ip->inode.iso_gid, ap->a_accmode, ap->a_cred));
 }
 
 static int

Modified: head/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- head/sys/fs/devfs/devfs_vnops.c     Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/fs/devfs/devfs_vnops.c     Wed Aug  5 09:27:03 2020        
(r363893)
@@ -533,7 +533,7 @@ devfs_access(struct vop_access_args *ap)
                de = de->de_dir;
 
        error = vaccess(vp->v_type, de->de_mode, de->de_uid, de->de_gid,
-           ap->a_accmode, ap->a_cred, NULL);
+           ap->a_accmode, ap->a_cred);
        if (error == 0)
                return (0);
        if (error != EACCES)

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vnops.c     Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/fs/ext2fs/ext2_vnops.c     Wed Aug  5 09:27:03 2020        
(r363893)
@@ -348,7 +348,7 @@ ext2_access(struct vop_access_args *ap)
                return (EPERM);
 
        error = vaccess(vp->v_type, ip->i_mode, ip->i_uid, ip->i_gid,
-           ap->a_accmode, ap->a_cred, NULL);
+           ap->a_accmode, ap->a_cred);
        return (error);
 }
 

Modified: head/sys/fs/fuse/fuse_internal.c
==============================================================================
--- head/sys/fs/fuse/fuse_internal.c    Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/fs/fuse/fuse_internal.c    Wed Aug  5 09:27:03 2020        
(r363893)
@@ -208,7 +208,7 @@ fuse_internal_access(struct vnode *vp,
 
                fuse_internal_getattr(vp, &va, cred, td);
                return vaccess(vp->v_type, va.va_mode, va.va_uid,
-                   va.va_gid, mode, cred, NULL);
+                   va.va_gid, mode, cred);
        }
 
        if (mode & VADMIN) {

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_vnops.c Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Wed Aug  5 09:27:03 2020        
(r363893)
@@ -250,7 +250,7 @@ msdosfs_access(struct vop_access_args *ap)
        }
 
        return (vaccess(vp->v_type, file_mode, pmp->pm_uid, pmp->pm_gid,
-           ap->a_accmode, ap->a_cred, NULL));
+           ap->a_accmode, ap->a_cred));
 }
 
 static int

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvnops.c Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/fs/nfsclient/nfs_clvnops.c Wed Aug  5 09:27:03 2020        
(r363893)
@@ -3393,8 +3393,8 @@ nfsspec_access(struct vop_access_args *ap)
        error = VOP_GETATTR(vp, vap, cred);
        if (error)
                goto out;
-       error  = vaccess(vp->v_type, vap->va_mode, vap->va_uid, vap->va_gid,
-           accmode, cred, NULL);
+       error = vaccess(vp->v_type, vap->va_mode, vap->va_uid, vap->va_gid,
+           accmode, cred);
 out:
        return error;
 }

Modified: head/sys/fs/pseudofs/pseudofs_vnops.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_vnops.c       Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/fs/pseudofs/pseudofs_vnops.c       Wed Aug  5 09:27:03 2020        
(r363893)
@@ -167,8 +167,8 @@ pfs_access(struct vop_access_args *va)
        error = VOP_GETATTR(vn, &vattr, va->a_cred);
        if (error)
                PFS_RETURN (error);
-       error = vaccess(vn->v_type, vattr.va_mode, vattr.va_uid,
-           vattr.va_gid, va->a_accmode, va->a_cred, NULL);
+       error = vaccess(vn->v_type, vattr.va_mode, vattr.va_uid, vattr.va_gid,
+           va->a_accmode, va->a_cred);
        PFS_RETURN (error);
 }
 

Modified: head/sys/fs/smbfs/smbfs_vnops.c
==============================================================================
--- head/sys/fs/smbfs/smbfs_vnops.c     Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/fs/smbfs/smbfs_vnops.c     Wed Aug  5 09:27:03 2020        
(r363893)
@@ -141,7 +141,7 @@ smbfs_access(ap)
        }
        mpmode = vp->v_type == VREG ? smp->sm_file_mode : smp->sm_dir_mode;
        return (vaccess(vp->v_type, mpmode, smp->sm_uid,
-           smp->sm_gid, ap->a_accmode, ap->a_cred, NULL));
+           smp->sm_gid, ap->a_accmode, ap->a_cred));
 }
 
 /* ARGSUSED */

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vnops.c     Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c     Wed Aug  5 09:27:03 2020        
(r363893)
@@ -396,8 +396,8 @@ tmpfs_access(struct vop_access_args *v)
                goto out;
        }
 
-       error = vaccess(vp->v_type, node->tn_mode, node->tn_uid,
-           node->tn_gid, accmode, cred, NULL);
+       error = vaccess(vp->v_type, node->tn_mode, node->tn_uid, node->tn_gid,
+           accmode, cred);
 
 out:
        MPASS(VOP_ISLOCKED(vp));

Modified: head/sys/fs/udf/udf_vnops.c
==============================================================================
--- head/sys/fs/udf/udf_vnops.c Wed Aug  5 09:25:59 2020        (r363892)
+++ head/sys/fs/udf/udf_vnops.c Wed Aug  5 09:27:03 2020        (r363893)
@@ -180,7 +180,7 @@ udf_access(struct vop_access_args *a)
        mode = udf_permtomode(node);
 
        return (vaccess(vp->v_type, mode, node->fentry->uid, node->fentry->gid,
-           accmode, a->a_cred, NULL));
+           accmode, a->a_cred));
 }
 
 static int

Modified: head/sys/kern/subr_acl_nfs4.c
==============================================================================
--- head/sys/kern/subr_acl_nfs4.c       Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/kern/subr_acl_nfs4.c       Wed Aug  5 09:27:03 2020        
(r363893)
@@ -172,7 +172,7 @@ _acl_denies(const struct acl *aclp, int access_mask, s
 
 int
 vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid,
-    struct acl *aclp, accmode_t accmode, struct ucred *cred, int *privused)
+    struct acl *aclp, accmode_t accmode, struct ucred *cred)
 {
        accmode_t priv_granted = 0;
        int denied, explicitly_denied, access_mask, is_directory,
@@ -187,9 +187,6 @@ vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_
        KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE),
                ("VAPPEND without VWRITE"));
 
-       if (privused != NULL)
-               *privused = 0;
-
        if (accmode & VADMIN)
                must_be_owner = 1;
 
@@ -289,9 +286,6 @@ vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_
                priv_granted |= VSTAT_PERMS;
 
        if ((accmode & priv_granted) == accmode) {
-               if (privused != NULL)
-                       *privused = 1;
-
                return (0);
        }
 

Modified: head/sys/kern/subr_acl_posix1e.c
==============================================================================
--- head/sys/kern/subr_acl_posix1e.c    Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/kern/subr_acl_posix1e.c    Wed Aug  5 09:27:03 2020        
(r363893)
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
  */
 int
 vaccess_acl_posix1e(enum vtype type, uid_t file_uid, gid_t file_gid,
-    struct acl *acl, accmode_t accmode, struct ucred *cred, int *privused)
+    struct acl *acl, accmode_t accmode, struct ucred *cred)
 {
        struct acl_entry *acl_other, *acl_mask;
        accmode_t dac_granted;
@@ -77,8 +77,6 @@ vaccess_acl_posix1e(enum vtype type, uid_t file_uid, g
         * privileges to use may be ambiguous due to "best match", in which
         * case fall back on first match for the time being.
         */
-       if (privused != NULL)
-               *privused = 0;
 
        /*
         * Determine privileges now, but don't apply until we've found a DAC
@@ -142,8 +140,6 @@ vaccess_acl_posix1e(enum vtype type, uid_t file_uid, g
                         */
                        if ((accmode & (dac_granted | priv_granted)) ==
                            accmode) {
-                               if (privused != NULL)
-                                       *privused = 1;
                                return (0);
                        }
                        goto error;
@@ -220,8 +216,6 @@ vaccess_acl_posix1e(enum vtype type, uid_t file_uid, g
                            accmode)
                                goto error;
 
-                       if (privused != NULL)
-                               *privused = 1;
                        return (0);
                }
        }
@@ -303,8 +297,6 @@ vaccess_acl_posix1e(enum vtype type, uid_t file_uid, g
                                    != accmode)
                                        break;
 
-                               if (privused != NULL)
-                                       *privused = 1;
                                return (0);
 
                        case ACL_GROUP:
@@ -327,8 +319,6 @@ vaccess_acl_posix1e(enum vtype type, uid_t file_uid, g
                                    != accmode)
                                        break;
 
-                               if (privused != NULL)
-                                       *privused = 1;
                                return (0);
 
                        default:
@@ -359,8 +349,6 @@ vaccess_acl_posix1e(enum vtype type, uid_t file_uid, g
         * XXXRW: Do privilege lookup here.
         */
        if ((accmode & (dac_granted | priv_granted)) == accmode) {
-               if (privused != NULL)
-                       *privused = 1;
                return (0);
        }
 

Modified: head/sys/kern/uipc_mqueue.c
==============================================================================
--- head/sys/kern/uipc_mqueue.c Wed Aug  5 09:25:59 2020        (r363892)
+++ head/sys/kern/uipc_mqueue.c Wed Aug  5 09:27:03 2020        (r363893)
@@ -1178,8 +1178,8 @@ mqfs_access(struct vop_access_args *ap)
        error = VOP_GETATTR(vp, &vattr, ap->a_cred);
        if (error)
                return (error);
-       error = vaccess(vp->v_type, vattr.va_mode, vattr.va_uid,
-           vattr.va_gid, ap->a_accmode, ap->a_cred, NULL);
+       error = vaccess(vp->v_type, vattr.va_mode, vattr.va_uid, vattr.va_gid,
+           ap->a_accmode, ap->a_cred);
        return (error);
 }
 
@@ -2088,7 +2088,7 @@ kern_kmq_open(struct thread *td, const char *upath, in
                        if (flags & FWRITE)
                                accmode |= VWRITE;
                        error = vaccess(VREG, pn->mn_mode, pn->mn_uid,
-                                   pn->mn_gid, accmode, td->td_ucred, NULL);
+                           pn->mn_gid, accmode, td->td_ucred);
                }
        }
 
@@ -2566,7 +2566,7 @@ mqf_chmod(struct file *fp, mode_t mode, struct ucred *
        pn = fp->f_data;
        sx_xlock(&mqfs_data.mi_lock);
        error = vaccess(VREG, pn->mn_mode, pn->mn_uid, pn->mn_gid, VADMIN,
-           active_cred, NULL);
+           active_cred);
        if (error != 0)
                goto out;
        pn->mn_mode = mode & ACCESSPERMS;

Modified: head/sys/kern/uipc_sem.c
==============================================================================
--- head/sys/kern/uipc_sem.c    Wed Aug  5 09:25:59 2020        (r363892)
+++ head/sys/kern/uipc_sem.c    Wed Aug  5 09:27:03 2020        (r363893)
@@ -212,7 +212,7 @@ ksem_chmod(struct file *fp, mode_t mode, struct ucred 
                goto out;
 #endif
        error = vaccess(VREG, ks->ks_mode, ks->ks_uid, ks->ks_gid, VADMIN,
-           active_cred, NULL);
+           active_cred);
        if (error != 0)
                goto out;
        ks->ks_mode = mode & ACCESSPERMS;
@@ -362,7 +362,7 @@ ksem_access(struct ksem *ks, struct ucred *ucred)
        int error;
 
        error = vaccess(VREG, ks->ks_mode, ks->ks_uid, ks->ks_gid,
-           VREAD | VWRITE, ucred, NULL);
+           VREAD | VWRITE, ucred);
        if (error)
                error = priv_check_cred(ucred, PRIV_SEM_WRITE);
        return (error);

Modified: head/sys/kern/uipc_shm.c
==============================================================================
--- head/sys/kern/uipc_shm.c    Wed Aug  5 09:25:59 2020        (r363892)
+++ head/sys/kern/uipc_shm.c    Wed Aug  5 09:27:03 2020        (r363893)
@@ -679,7 +679,7 @@ shm_access(struct shmfd *shmfd, struct ucred *ucred, i
                accmode |= VWRITE;
        mtx_lock(&shm_timestamp_lock);
        error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid,
-           accmode, ucred, NULL);
+           accmode, ucred);
        mtx_unlock(&shm_timestamp_lock);
        return (error);
 }
@@ -1240,8 +1240,8 @@ shm_chmod(struct file *fp, mode_t mode, struct ucred *
        if (error != 0)
                goto out;
 #endif
-       error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid,
-           shmfd->shm_gid, VADMIN, active_cred, NULL);
+       error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid,
+           VADMIN, active_cred);
        if (error != 0)
                goto out;
        shmfd->shm_mode = mode & ACCESSPERMS;

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c    Wed Aug  5 09:25:59 2020        (r363892)
+++ head/sys/kern/vfs_subr.c    Wed Aug  5 09:27:03 2020        (r363893)
@@ -5299,14 +5299,12 @@ vaccess_vexec_smr(mode_t file_mode, uid_t file_uid, gi
 
 /*
  * Common filesystem object access control check routine.  Accepts a
- * vnode's type, "mode", uid and gid, requested access mode, credentials,
- * and optional call-by-reference privused argument allowing vaccess()
- * to indicate to the caller whether privilege was used to satisfy the
- * request (obsoleted).  Returns 0 on success, or an errno on failure.
+ * vnode's type, "mode", uid and gid, requested access mode, and credentials.
+ * Returns 0 on success, or an errno on failure.
  */
 int
 vaccess(enum vtype type, mode_t file_mode, uid_t file_uid, gid_t file_gid,
-    accmode_t accmode, struct ucred *cred, int *privused)
+    accmode_t accmode, struct ucred *cred)
 {
        accmode_t dac_granted;
        accmode_t priv_granted;
@@ -5321,9 +5319,6 @@ vaccess(enum vtype type, mode_t file_mode, uid_t file_
         * as requested.  If it exists, go with that.
         */
 
-       if (privused != NULL)
-               *privused = 0;
-
        dac_granted = 0;
 
        /* Check the owner. */
@@ -5409,9 +5404,6 @@ privcheck:
                priv_granted |= VADMIN;
 
        if ((accmode & (priv_granted | dac_granted)) == accmode) {
-               /* XXX audit: privilege used */
-               if (privused != NULL)
-                       *privused = 1;
                return (0);
        }
 

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h        Wed Aug  5 09:25:59 2020        (r363892)
+++ head/sys/sys/vnode.h        Wed Aug  5 09:27:03 2020        (r363893)
@@ -667,16 +667,14 @@ int       vn_commname(struct vnode *vn, char *buf, u_int 
buf
 int    vn_path_to_global_path(struct thread *td, struct vnode *vp,
            char *path, u_int pathlen);
 int    vaccess(enum vtype type, mode_t file_mode, uid_t file_uid,
-           gid_t file_gid, accmode_t accmode, struct ucred *cred,
-           int *privused);
+           gid_t file_gid, accmode_t accmode, struct ucred *cred);
 int    vaccess_vexec_smr(mode_t file_mode, uid_t file_uid, gid_t file_gid,
            struct ucred *cred);
 int    vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid,
-           struct acl *aclp, accmode_t accmode, struct ucred *cred,
-           int *privused);
+           struct acl *aclp, accmode_t accmode, struct ucred *cred);
 int    vaccess_acl_posix1e(enum vtype type, uid_t file_uid,
            gid_t file_gid, struct acl *acl, accmode_t accmode,
-           struct ucred *cred, int *privused);
+           struct ucred *cred);
 void   vattr_null(struct vattr *vap);
 int    vcount(struct vnode *vp);
 void   vlazy(struct vnode *);

Modified: head/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- head/sys/ufs/ufs/ufs_vnops.c        Wed Aug  5 09:25:59 2020        
(r363892)
+++ head/sys/ufs/ufs/ufs_vnops.c        Wed Aug  5 09:27:03 2020        
(r363893)
@@ -390,12 +390,12 @@ ufs_accessx(ap)
                case 0:
                        if (type == ACL_TYPE_NFS4) {
                                error = vaccess_acl_nfs4(vp->v_type, ip->i_uid,
-                                   ip->i_gid, acl, accmode, ap->a_cred, NULL);
+                                   ip->i_gid, acl, accmode, ap->a_cred);
                        } else {
                                error = vfs_unixify_accmode(&accmode);
                                if (error == 0)
                                        error = vaccess_acl_posix1e(vp->v_type, 
ip->i_uid,
-                                           ip->i_gid, acl, accmode, 
ap->a_cred, NULL);
+                                           ip->i_gid, acl, accmode, 
ap->a_cred);
                        }
                        break;
                default:
@@ -410,8 +410,8 @@ ufs_accessx(ap)
                         */
                        error = vfs_unixify_accmode(&accmode);
                        if (error == 0)
-                               error = vaccess(vp->v_type, ip->i_mode, 
ip->i_uid,
-                                   ip->i_gid, accmode, ap->a_cred, NULL);
+                               error = vaccess(vp->v_type, ip->i_mode,
+                                   ip->i_uid, ip->i_gid, accmode, ap->a_cred);
                }
                acl_free(acl);
 
@@ -421,7 +421,7 @@ ufs_accessx(ap)
        error = vfs_unixify_accmode(&accmode);
        if (error == 0)
                error = vaccess(vp->v_type, ip->i_mode, ip->i_uid, ip->i_gid,
-                   accmode, ap->a_cred, NULL);
+                   accmode, ap->a_cred);
        return (error);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to