From: Paul Menage <pmenage@ensim.com>
To: viro@math.psu.edu, torvalds@transmeta.edu
Cc: pmenage@ensim.com, linux-kernel@vger.kernel.org
Subject: [PATCH] Replace exec_permission_lite() with inlined vfs_permission()
Date: Thu, 02 May 2002 18:44:13 -0700 [thread overview]
Message-ID: <E173S7J-0004EH-00@pmenage-dt.ensim.com> (raw)
Since exec_permission_lite() is now basically an inlined and
constant-propagated duplicate of vfs_permission(), this patch drops
exec_permission_lite() and makes vfs_permission() inlined (but not
static) and calls it from link_path_walk() if the inode doesn't have an
i_op->permission() method.
diff -X /mnt/elbrus/home/pmenage/dontdiff -aur linux-2.5.13/fs/namei.c linux-2.5.13-permission/fs/namei.c
--- linux-2.5.13/fs/namei.c Thu May 2 17:22:48 2002
+++ linux-2.5.13-permission/fs/namei.c Thu May 2 17:48:11 2002
@@ -153,7 +153,7 @@
* for filesystem access without changing the "normal" uids which
* are used for other things..
*/
-int vfs_permission(struct inode * inode, int mask)
+inline int vfs_permission(struct inode * inode, int mask)
{
umode_t mode = inode->i_mode;
@@ -300,40 +300,6 @@
}
/*
- * Short-cut version of permission(), for calling by
- * path_walk(), when dcache lock is held. Combines parts
- * of permission() and vfs_permission(), and tests ONLY for
- * MAY_EXEC permission.
- *
- * If appropriate, check DAC only. If not appropriate, or
- * short-cut DAC fails, then call permission() to do more
- * complete permission check.
- */
-static inline int exec_permission_lite(struct inode *inode)
-{
- umode_t mode = inode->i_mode;
-
- if ((inode->i_op && inode->i_op->permission))
- return -EAGAIN;
-
- if (current->fsuid == inode->i_uid)
- mode >>= 6;
- else if (in_group_p(inode->i_gid))
- mode >>= 3;
-
- if (mode & MAY_EXEC)
- return 0;
-
- if ((inode->i_mode & S_IXUGO) && capable(CAP_DAC_OVERRIDE))
- return 0;
-
- if (S_ISDIR(inode->i_mode) && capable(CAP_DAC_READ_SEARCH))
- return 0;
-
- return -EACCES;
-}
-
-/*
* This is called when everything else fails, and we actually have
* to go to the low-level filesystem to find out what we should do..
*
@@ -578,11 +544,12 @@
struct qstr this;
unsigned int c;
- err = exec_permission_lite(inode);
- if (err == -EAGAIN) {
+ if(inode->i_op && inode->i_op->permission) {
unlock_nd(nd);
err = permission(inode, MAY_EXEC);
lock_nd(nd);
+ } else {
+ err = vfs_permission(inode, MAY_EXEC);
}
if (err)
break;
next reply other threads:[~2002-05-03 1:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-03 1:44 Paul Menage [this message]
2002-05-03 2:16 ` Alexander Viro
2002-05-03 2:36 ` Paul Menage
2002-05-03 9:03 ` Paul Menage
2002-05-03 9:09 ` Alexander Viro
2002-05-03 17:23 ` Paul Menage
2002-05-03 18:14 ` Trond Myklebust
2002-05-03 9:10 ` Paul Menage
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E173S7J-0004EH-00@pmenage-dt.ensim.com \
--to=pmenage@ensim.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.edu \
--cc=viro@math.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®