• Jan Kara's avatar
    ext4: be more strict when verifying flags set via SETFLAGS ioctls · d14e7683
    Jan Kara authored
    Currently we just silently ignore flags that we don't understand (or
    that cannot be manipulated) through EXT4_IOC_SETFLAGS and
    EXT4_IOC_FSSETXATTR ioctls. This makes it problematic for the unused
    flags to be used in future (some app may be inadvertedly setting them
    and we won't notice until the flag gets used). Also this is inconsistent
    with other filesystems like XFS or BTRFS which return EOPNOTSUPP when
    they see a flag they cannot set.
    
    ext4 has the additional problem that there are flags which are returned
    by EXT4_IOC_GETFLAGS ioctl but which cannot be modified via
    EXT4_IOC_SETFLAGS. So we have to be careful to ignore value of these
    flags and not fail the ioctl when they are set (as e.g. chattr(1) passes
    flags returned from EXT4_IOC_GETFLAGS to EXT4_IOC_SETFLAGS without any
    masking and thus we'd break this utility).
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
    d14e7683
ext4.h 116 KB