From: Andreas Dilger <adilger@dilger.ca>
To: Al Viro <viro@zeniv.linux.org.uk>,
Andreas Gruenbacher <agruenba@redhat.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Fwd: posix_acl_permission() and MAY_* flags
Date: Thu, 11 Oct 2018 18:43:57 -0600 [thread overview]
Message-ID: <ADCDD815-9330-4BF2-B3BB-67F7AA223098@dilger.ca> (raw)
In-Reply-To: 1254FD78-8392-4B97-A191-EDA01B719635@whamcloud.com
[-- Attachment #1: Type: text/plain, Size: 1084 bytes --]
I was looking at POSIX ACL on-disk and in-memory code and it looks like
there is a subtle dependency between the on-disk format and what (IMHO)
would be considered in-memory declarations.
When a POSIX ACL is read from disk, posix_acl_from_mode() copies the file
mode (S_I[RWX][UGO]) into the e_perm fields of the ACL default entries.
Similarly, in posix_acl_equiv_mode() and posix_acl_create_masq() it uses
S_IRWXO to mask the e_perm flags.
However, later on in posix_acl_permission() it directly uses the "want"
flag contains MAY_{READ,WRITE,EXEC} flags and compares those to e_perm of
each ACL entry.
In posix_acl_valid() it compares e_perm with ACL_{READ,WRITE,EXECUTE}.
While the MAY_[RWX] and ACL_[RWX] currently have the same value as
S_I[RWX]OTH, it isn't very clear that these flags MUST all have the same
values or POSIX ACLs will break.
This definitely doesn't seem quite right. Are the ACL_* constants the
values to be used, with "conversion" in between the flags/modes? Should
there be a BUILD_BUG_ON() that trips if those values ever differ?
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
next parent reply other threads:[~2018-10-12 8:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1254FD78-8392-4B97-A191-EDA01B719635@whamcloud.com>
2018-10-12 0:43 ` Andreas Dilger [this message]
2018-10-12 9:09 ` posix_acl_permission() and MAY_* flags Andreas Grünbacher
2018-10-13 3:56 ` Al Viro
2018-10-13 4:08 ` Andreas Dilger
2018-10-13 4:37 ` Al Viro
2018-10-13 3:40 ` Fwd: " Al Viro
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=ADCDD815-9330-4BF2-B3BB-67F7AA223098@dilger.ca \
--to=adilger@dilger.ca \
--cc=agruenba@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).