[PATCH] take noexec checks to very few callers that care

Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
Al Viro 2008-07-22 00:02:33 -04:00
commit 30524472c2
3 changed files with 17 additions and 9 deletions

View file

@ -461,6 +461,16 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
if (res)
goto out;
if ((mode & MAY_EXEC) && S_ISREG(nd.path.dentry->d_inode->i_mode)) {
/*
* MAY_EXEC on regular files is denied if the fs is mounted
* with the "noexec" flag.
*/
res = -EACCES;
if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
goto out_path_release;
}
res = vfs_permission(&nd, mode | MAY_ACCESS);
/* SuS v2 requires we report a read only fs too */
if(res || !(mode & S_IWOTH) ||