From: "Ernesto A. Fernández" <ernesto.mnd.fernandez@gmail.com>
To: Jan Kara <jack@suse.com>, Theodore Ts'o <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Dave Kleikamp <shaggy@kernel.org>,
linux-ext4@vger.kernel.org, jfs-discussion@lists.sourceforge.net,
reiserfs-devel@vger.kernel.org
Subject: [PATCH 0/5] Failure to set acl may alter group permissions
Date: Wed, 12 Jul 2017 06:53:22 -0300 [thread overview]
Message-ID: <cover.1499805484.git.ernesto.mnd.fernandez@gmail.com> (raw)
When changing a file's acl mask, the function that sets the access control
list (ext2_set_acl(), __ext4_set_acl(), __jfs_set_acl()...) will first set
the group permission bits of the file to the value of the mask (by calling
posix_acl_update_mode()), and only then set the actual extended attribute
representing the new acl.
The problem is, none of these functions try to restore the original
permission bits if the second part fails. If this happens to a file that
had no acl attributes to begin with, the system will from now on assume
that the mask permission bits are actual group permission bits,
potentially granting access to the wrong users.
If your working directory is on a filesystem mounted with extended user
attributes (and acl of course), this script will trigger the issue by
filling the drive:
touch test.file
chmod go-rwx test.file
yes xxxxxxxxxx > test.file
i=1
while setfattr -n user.$i test.file; do
((++i))
done
setfacl -m m:r test.file
By the time the script returns, the group that owns test.file may have read
permissions that were never granted. This happens reliably on at least
ext2, ext4, jfs and reiserfs.
I will follow this mail with patch drafts for those filesystems. I believe
most filesystems that support acl will need a patch, but perhaps it's best
if I share what I have so far.
Thank you for your attention.
Ernesto A. Fern√°ndez (5):
ext4: preserve i_mode if __ext4_set_acl() fails
ext2: preserve i_mode if ext2_set_acl() fails
ext2: fix line over 80 characters in ext2_set_acl()
jfs: preserve i_mode if __jfs_set_acl() fails
reiserfs: preserve i_mode if __reiserfs_set_acl() fails
fs/ext2/acl.c | 25 ++++++++++++++++---------
fs/ext4/acl.c | 15 +++++++++++----
fs/jfs/acl.c | 15 +++++++++++----
fs/reiserfs/xattr.c | 4 ++++
fs/reiserfs/xattr_acl.c | 25 +++++++++----------------
5 files changed, 51 insertions(+), 33 deletions(-)
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2017-07-12 9:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 9:53 Ernesto A. Fernández [this message]
2017-07-12 9:53 ` [PATCH 1/5] ext4: preserve i_mode if __ext4_set_acl() fails Ernesto A. Fernández
2017-07-17 15:33 ` Jan Kara
2017-07-31 2:44 ` Theodore Ts'o
2017-07-12 9:54 ` [PATCH 2/5] ext2: preserve i_mode if ext2_set_acl() fails Ernesto A. Fernández
2017-07-17 16:33 ` Jan Kara
2017-07-12 9:54 ` [PATCH 3/5] ext2: fix line over 80 characters in ext2_set_acl() Ernesto A. Fernández
2017-07-17 16:33 ` Jan Kara
2017-07-12 9:55 ` [PATCH 4/5] jfs: preserve i_mode if __jfs_set_acl() fails Ernesto A. Fernández
2017-07-13 21:01 ` Dave Kleikamp
2017-07-12 9:56 ` [PATCH 5/5] reiserfs: preserve i_mode if __reiserfs_set_acl() fails Ernesto A. Fernández
2017-07-17 16:45 ` Jan Kara
2017-07-12 11:47 ` [PATCH 0/5] Failure to set acl may alter group permissions Christoph Hellwig
2017-07-13 9:40 ` [xfstests PATCH] generic: add test of file mode when setfacl fails Ernesto A. Fernández
2017-07-13 11:55 ` Christoph Hellwig
2017-07-14 5:40 ` Ernesto A. Fernández
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=cover.1499805484.git.ernesto.mnd.fernandez@gmail.com \
--to=ernesto.mnd.fernandez@gmail.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-ext4@vger.kernel.org \
--cc=reiserfs-devel@vger.kernel.org \
--cc=shaggy@kernel.org \
--cc=tytso@mit.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;
as well as URLs for NNTP newsgroup(s).