diff --git a/sys/kern/subr_acl_nfs4.c b/sys/kern/subr_acl_nfs4.c index fbd233ba7646..19ac1b021d8b 100644 --- a/sys/kern/subr_acl_nfs4.c +++ b/sys/kern/subr_acl_nfs4.c @@ -163,6 +163,14 @@ vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid, int denied, explicitly_denied, access_mask, is_directory, must_be_owner = 0; + KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND | + VEXPLICIT_DENY | VREAD_NAMED_ATTRS | VWRITE_NAMED_ATTRS | + VDELETE_CHILD | VREAD_ATTRIBUTES | VWRITE_ATTRIBUTES | VDELETE | + VREAD_ACL | VWRITE_ACL | VWRITE_OWNER | VSYNCHRONIZE)) == 0, + ("invalid bit in accmode")); + KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE), + ("VAPPEND without VWRITE")); + if (privused != NULL) *privused = 0; diff --git a/sys/kern/subr_acl_posix1e.c b/sys/kern/subr_acl_posix1e.c index 9690580e3d8c..600067c279ad 100644 --- a/sys/kern/subr_acl_posix1e.c +++ b/sys/kern/subr_acl_posix1e.c @@ -63,6 +63,8 @@ vaccess_acl_posix1e(enum vtype type, uid_t file_uid, gid_t file_gid, KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0, ("invalid bit in accmode")); + KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE), + ("VAPPEND without VWRITE")); /* * Look for a normal, non-privileged way to access the file/directory diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index cb6920f6bec3..9fe4d43e8b17 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -3534,6 +3534,8 @@ vaccess(enum vtype type, mode_t file_mode, uid_t file_uid, gid_t file_gid, KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0, ("invalid bit in accmode")); + KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE), + ("VAPPEND without VWRITE")); /* * Look for a normal, non-privileged way to access the file/directory