ltp icon indicating copy to clipboard operation
ltp copied to clipboard

write regression test for "attr: block mode changes of symlinks"

Open metan-ucw opened this issue 1 year ago • 3 comments

commit 5d1f903f75a80daa4dfb3d84e114ec8ecbf29956
Author: Christian Brauner <[email protected]>
Date:   Wed Jul 12 20:58:49 2023 +0200

    attr: block mode changes of symlinks

   Changing the mode of symlinks is meaningless as the vfs doesn't take the
    mode of a symlink into account during path lookup permission checking.
    
    However, the vfs doesn't block mode changes on symlinks. This however,
    has lead to an untenable mess roughly classifiable into the following
    two categories:
    
    (1) Filesystems that don't implement a i_op->setattr() for symlinks.
    
        Such filesystems may or may not know that without i_op->setattr()
        defined, notify_change() falls back to simple_setattr() causing the
        inode's mode in the inode cache to be changed.
    
        That's a generic issue as this will affect all non-size changing
        inode attributes including ownership changes.
    
        Example: afs
    
    (2) Filesystems that fail with EOPNOTSUPP but change the mode of the
        symlink nonetheless.

        Some filesystems will happily update the mode of a symlink but still
        return EOPNOTSUPP. This is the biggest source of confusion for
        userspace.
    
        The EOPNOTSUPP in this case comes from POSIX ACLs. Specifically it
        comes from filesystems that call posix_acl_chmod(), e.g., btrfs via
    
            if (!err && attr->ia_valid & ATTR_MODE)
                    err = posix_acl_chmod(idmap, dentry, inode->i_mode);
    
        Filesystems including btrfs don't implement i_op->set_acl() so
        posix_acl_chmod() will report EOPNOTSUPP.
    
        When posix_acl_chmod() is called, most filesystems will have
        finished updating the inode.
    
        Perversely, this has the consequences that this behavior may depend
        on two kconfig options and mount options:
    
        * CONFIG_POSIX_ACL={y,n}
        * CONFIG_${FSTYPE}_POSIX_ACL={y,n}
        * Opt_acl, Opt_noacl

        Example: btrfs, ext4, xfs

metan-ucw avatar Sep 01 '23 09:09 metan-ucw

checking

coolgw avatar May 09 '24 06:05 coolgw

https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/

coolgw avatar May 10 '24 00:05 coolgw

https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/

v2 need review https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/

coolgw avatar May 28 '24 09:05 coolgw