Introduce a mount flag with which filesystems can idicate that they
support permissions beyond MAY_READ, MAY_WRITE, and MAY_EXEC. If
that flag is set, pass MAY_APPEND through to the filesystems'
permission inode operation.
Signed-off-by: Andreas Gruenbacher <[email protected]>
Index: linux-2.6.18-rc6/fs/namei.c
===================================================================
--- linux-2.6.18-rc6.orig/fs/namei.c
+++ linux-2.6.18-rc6/fs/namei.c
@@ -228,7 +228,7 @@ int generic_permission(struct inode *ino
int permission(struct inode *inode, int mask, struct nameidata *nd)
{
umode_t mode = inode->i_mode;
- int retval, submask;
+ int retval, submask = mask;
if (mask & MAY_WRITE) {
@@ -254,8 +254,8 @@ int permission(struct inode *inode, int
if ((mask & MAY_EXEC) && S_ISREG(mode) && !(mode & S_IXUGO))
return -EACCES;
- /* Ordinary permission routines do not understand MAY_APPEND. */
- submask = mask & ~MAY_APPEND;
+ if (!IS_XPERM(inode))
+ submask &= (MAY_READ | MAY_WRITE | MAY_EXEC);
if (inode->i_op && inode->i_op->permission)
retval = inode->i_op->permission(inode, submask, nd);
else
Index: linux-2.6.18-rc6/include/linux/fs.h
===================================================================
--- linux-2.6.18-rc6.orig/include/linux/fs.h
+++ linux-2.6.18-rc6/include/linux/fs.h
@@ -119,6 +119,8 @@ extern int dir_notify_enable;
#define MS_PRIVATE (1<<18) /* change to private */
#define MS_SLAVE (1<<19) /* change to slave */
#define MS_SHARED (1<<20) /* change to shared */
+#define MS_XPERM (1<<21) /* permission function understands more than
+ MAY_{READ,WRITE,EXEC} */
#define MS_ACTIVE (1<<30)
#define MS_NOUSER (1<<31)
@@ -172,6 +174,7 @@ extern int dir_notify_enable;
#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
+#define IS_XPERM(inode) __IS_FLG(inode, MS_XPERM)
#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
--
Andreas Gruenbacher <[email protected]>
SUSE Labs, SUSE LINUX Products GmbH / Novell Inc.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]