reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Failure to set acl may alter group permissions
@ 2017-07-12  9:53 Ernesto A. Fernández
  2017-07-12  9:53 ` [PATCH 1/5] ext4: preserve i_mode if __ext4_set_acl() fails Ernesto A. Fernández
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Ernesto A. Fernández @ 2017-07-12  9:53 UTC (permalink / raw)
  To: Jan Kara, Theodore Ts'o, Andreas Dilger, Dave Kleikamp,
	linux-ext4, jfs-discussion, reiserfs-devel

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-07-31  2:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-12  9:53 [PATCH 0/5] Failure to set acl may alter group permissions Ernesto A. Fernández
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

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).