summaryrefslogtreecommitdiff
path: root/fs/ecryptfs
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.de>2022-08-16 16:42:56 -0500
committerDavid Sterba <dsterba@suse.com>2022-08-22 18:06:30 +0200
commitb51111271b0352aa596c5ae8faf06939e91b3b68 (patch)
tree6ae28c6f1810bced5cb8c9cb7f563fb4f2809b21 /fs/ecryptfs
parent899b7f69f244e539ea5df1b4d756046337de44a5 (diff)
btrfs: check if root is readonly while setting security xattr
For a filesystem which has btrfs read-only property set to true, all write operations including xattr should be denied. However, security xattr can still be changed even if btrfs ro property is true. This happens because xattr_permission() does not have any restrictions on security.*, system.* and in some cases trusted.* from VFS and the decision is left to the underlying filesystem. See comments in xattr_permission() for more details. This patch checks if the root is read-only before performing the set xattr operation. Testcase: DEV=/dev/vdb MNT=/mnt mkfs.btrfs -f $DEV mount $DEV $MNT echo "file one" > $MNT/f1 setfattr -n "security.one" -v 2 $MNT/f1 btrfs property set /mnt ro true setfattr -n "security.one" -v 1 $MNT/f1 umount $MNT CC: stable@vger.kernel.org # 4.9+ Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/ecryptfs')
0 files changed, 0 insertions, 0 deletions