Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Dec 2009 11:36:10 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r201019 - head/sys/kern
Message-ID:  <200912261136.nBQBaAh3009032@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sat Dec 26 11:36:10 2009
New Revision: 201019
URL: http://svn.freebsd.org/changeset/base/201019

Log:
  Now that all the callers seem to be fixed, add KASSERTs to make sure VAPPEND
  is not being used improperly.

Modified:
  head/sys/kern/subr_acl_nfs4.c
  head/sys/kern/subr_acl_posix1e.c
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/subr_acl_nfs4.c
==============================================================================
--- head/sys/kern/subr_acl_nfs4.c	Sat Dec 26 11:03:10 2009	(r201018)
+++ head/sys/kern/subr_acl_nfs4.c	Sat Dec 26 11:36:10 2009	(r201019)
@@ -163,6 +163,14 @@ vaccess_acl_nfs4(enum vtype type, uid_t 
 	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;
 

Modified: head/sys/kern/subr_acl_posix1e.c
==============================================================================
--- head/sys/kern/subr_acl_posix1e.c	Sat Dec 26 11:03:10 2009	(r201018)
+++ head/sys/kern/subr_acl_posix1e.c	Sat Dec 26 11:36:10 2009	(r201019)
@@ -63,6 +63,8 @@ vaccess_acl_posix1e(enum vtype type, uid
 
 	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

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sat Dec 26 11:03:10 2009	(r201018)
+++ head/sys/kern/vfs_subr.c	Sat Dec 26 11:36:10 2009	(r201019)
@@ -3534,6 +3534,8 @@ vaccess(enum vtype type, mode_t file_mod
 
 	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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912261136.nBQBaAh3009032>