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]
Message-ID: <87v85d9at2.fsf@mailhost.krisman.be>
Date: Fri, 22 Mar 2024 18:11:21 -0400
From: Gabriel Krisman Bertazi <krisman@...e.de>
To: Eugen Hristev <eugen.hristev@...labora.com>
Cc: tytso@....edu,  adilger.kernel@...ger.ca,  linux-ext4@...r.kernel.org,
  jaegeuk@...nel.org,  chao@...nel.org,
  linux-f2fs-devel@...ts.sourceforge.net,  linux-fsdevel@...r.kernel.org,
  linux-kernel@...r.kernel.org,  kernel@...labora.com,
  viro@...iv.linux.org.uk,  brauner@...nel.org,  jack@...e.cz
Subject: Re: [PATCH v14 7/9] f2fs: Log error when lookup of encoded dentry
 fails

Eugen Hristev <eugen.hristev@...labora.com> writes:

> If the volume is in strict mode, generi c_ci_compare can report a broken
> encoding name.  This will not trigger on a bad lookup, which is caught
> earlier, only if the actual disk name is bad.
>
> Suggested-by: Gabriel Krisman Bertazi <krisman@...e.de>
> Signed-off-by: Eugen Hristev <eugen.hristev@...labora.com>
> ---
>  fs/f2fs/dir.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
> index 88b0045d0c4f..3b0003e8767a 100644
> --- a/fs/f2fs/dir.c
> +++ b/fs/f2fs/dir.c
> @@ -192,11 +192,22 @@ static inline int f2fs_match_name(const struct inode *dir,
>  	struct fscrypt_name f;
>  
>  #if IS_ENABLED(CONFIG_UNICODE)
> -	if (fname->cf_name.name)
> -		return generic_ci_match(dir, fname->usr_fname,
> -					&fname->cf_name,
> -					de_name, de_name_len);
> -
> +	if (fname->cf_name.name) {
> +		int ret = generic_ci_match(dir, fname->usr_fname,
> +					   &fname->cf_name,
> +					   de_name, de_name_len);
> +		if (ret < 0) {
> +			/*
> +			 * Treat comparison errors as not a match.  The
> +			 * only case where it happens is on a disk
> +			 * corruption or ENOMEM.
> +			 */
> +			if (ret == -EINVAL)
> +				f2fs_warn(F2FS_SB(dir->i_sb),
> +					"Directory contains filename that is invalid UTF-8");
> +		}
> +		return ret;

No point in checking ret < 0 and then ret == -EINVAL. just check for
-EINVAL.  That was ok in ext4 because we actually need to change ret to
false.

> +	}
>  #endif
>  	f.usr_fname = fname->usr_fname;
>  	f.disk_name = fname->disk_name;

-- 
Gabriel Krisman Bertazi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ