From: Andreas Gruenbacher <agruen@suse.de>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: permission() bug?
Date: Thu, 16 Oct 2003 17:05:19 +0200 [thread overview]
Message-ID: <1066316719.15192.3.camel@E136.suse.de> (raw)
Hello,
I think there is a bug in fs/namei.c:vfs_permission(). The function
contains:
int vfs_permission(struct inode * inode, int mask)
{
[...]
/*
* Read/write DACs are always overridable.
* Executable DACs are overridable if at least one exec
* bit is set.
*/
if ((mask & (MAY_READ|MAY_WRITE)) || (inode->i_mode & S_IXUGO))
if (capable(CAP_DAC_OVERRIDE))
return 0;
[...]
return -EACCES;
}
The comment makes sense; the code doesn't quite implement what the
comment says. Consider the case of an inode with "--" permissions. We
get the following results:
permission(inode, MAY_READ) = 0
permission(inode, MAY_EXEC) = -EACCESS
permission(inode, MAY_READ|MAY_EXEC = 0
The last result seems wrong; I would expect -EACCESS instead. So IMHO
the code in permission (and in the file system specific copies) should
read:
if (!(mask & MAY_EXEC) || (inode->i_mode & S_IXUGO))
if (capable(CAP_DAC_OVERRIDE))
return 0;
Regards,
--
Andreas Gruenbacher <agruen@suse.de>
SuSE Labs, SuSE Linux AG <http://www.suse.de/>
next reply other threads:[~2003-10-16 15:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-16 15:05 Andreas Gruenbacher [this message]
2003-10-17 11:02 ` Michael Kerrisk
2004-02-01 12:36 Andreas Gruenbacher
2004-02-01 21:14 ` Andrew Morton
2004-02-01 23:24 ` Andries Brouwer
2004-02-02 3:52 ` Andreas Gruenbacher
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=1066316719.15192.3.camel@E136.suse.de \
--to=agruen@suse.de \
--cc=linux-kernel@vger.kernel.org \
/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®