lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 20 Jul 2021 15:33:20 +0800
From:   JeffleXu <jefflexu@...ux.alibaba.com>
To:     "Darrick J. Wong" <djwong@...nel.org>
Cc:     viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
        linux-ext4@...r.kernel.org
Subject: Re: [PATCH v2] vfs: only allow SETFLAGS to set DAX flag on files and
 dirs



On 7/20/21 1:43 AM, Darrick J. Wong wrote:
> On Mon, Jul 19, 2021 at 10:38:34AM +0800, Jeffle Xu wrote:
>> This is similar to commit dbc77f31e58b ("vfs: only allow FSSETXATTR to
>> set DAX flag on files and dirs").
>>
>> Though the underlying filesystems may have filtered invalid flags, e.g.,
>> ext4_mask_flags() called in ext4_fileattr_set(), also check it in VFS
>> layer.
>>
>> Signed-off-by: Jeffle Xu <jefflexu@...ux.alibaba.com>
>> ---
>> changes since v1:
>> - add separate parentheses surrounding flag tests
>> ---
>>  fs/ioctl.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/ioctl.c b/fs/ioctl.c
>> index 1e2204fa9963..90cfaa4db03a 100644
>> --- a/fs/ioctl.c
>> +++ b/fs/ioctl.c
>> @@ -835,7 +835,7 @@ static int fileattr_set_prepare(struct inode *inode,
>>  	 * It is only valid to set the DAX flag on regular files and
>>  	 * directories on filesystems.
>>  	 */
>> -	if ((fa->fsx_xflags & FS_XFLAG_DAX) &&
>> +	if (((fa->fsx_xflags & FS_XFLAG_DAX) || (fa->flags & FS_DAX_FL)) &&
> 
> Isn't fileattr_fill_flags supposed to fill out fa->fsx_xflags from
> fa->flags for a SETFLAGS call?

Yes, but fa->fsx_xflags inherited from fa->flags (at least in ext4 it
is) is the original flags/xflags of the file before SETFLAG/FSSETXATTR.
Here we want to check *new* flags/xflags.

> 
>>  	    !(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
>>  		return -EINVAL;
>>  
>> -- 
>> 2.27.0
>>

-- 
Thanks,
Jeffle

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ