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: <avtj6ud7hb7qyya4ekj24lu2jwmirlqspxa4ptmhjrvuhrgfx6@ghzl2aqdokkg>
Date: Wed, 21 Jan 2026 11:15:26 +0100
From: Jan Kara <jack@...e.cz>
To: Chuck Lever <cel@...nel.org>
Cc: Al Viro <viro@...iv.linux.org.uk>, 
	Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, linux-fsdevel@...r.kernel.org, 
	linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org, linux-cifs@...r.kernel.org, 
	linux-nfs@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net, 
	hirofumi@...l.parknet.co.jp, linkinjeon@...nel.org, sj1557.seo@...sung.com, 
	yuezhang.mo@...y.com, almaz.alexandrovich@...agon-software.com, slava@...eyko.com, 
	glaubitz@...sik.fu-berlin.de, frank.li@...o.com, tytso@....edu, adilger.kernel@...ger.ca, 
	cem@...nel.org, sfrench@...ba.org, pc@...guebit.org, ronniesahlberg@...il.com, 
	sprasad@...rosoft.com, trondmy@...nel.org, anna@...nel.org, jaegeuk@...nel.org, 
	chao@...nel.org, hansg@...nel.org, senozhatsky@...omium.org, 
	Chuck Lever <chuck.lever@...cle.com>
Subject: Re: [PATCH v6 01/16] fs: Add case sensitivity flags to file_kattr

On Tue 20-01-26 09:24:24, Chuck Lever wrote:
> From: Chuck Lever <chuck.lever@...cle.com>
> 
> Enable upper layers such as NFSD to retrieve case sensitivity
> information from file systems by adding FS_XFLAG_CASEFOLD and
> FS_XFLAG_CASENONPRESERVING flags.
> 
> Filesystems report case-insensitive or case-nonpreserving behavior
> by setting these flags directly in fa->fsx_xflags. The default
> (flags unset) indicates POSIX semantics: case-sensitive and
> case-preserving. These flags are read-only; userspace cannot set
> them via ioctl.
> 
> Relocate struct file_kattr initialization from fileattr_fill_xflags()
> and fileattr_fill_flags() to vfs_fileattr_get() and the ioctl/syscall
> call sites. This allows filesystem ->fileattr_get() callbacks to set
> flags directly in fa->fsx_xflags before invoking the fill functions,
> which previously would have zeroed those values. Callers that bypass
> vfs_fileattr_get() must now zero-initialize the struct themselves.
> 
> Case sensitivity information is exported to userspace via the
> fa_xflags field in the FS_IOC_FSGETXATTR ioctl and file_getattr()
> system call.
> 
> Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
> ---
>  fs/file_attr.c           | 14 ++++++--------
>  fs/xfs/xfs_ioctl.c       |  2 +-
>  include/linux/fileattr.h |  3 ++-
>  include/uapi/linux/fs.h  |  2 ++
>  4 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/file_attr.c b/fs/file_attr.c
> index 13cdb31a3e94..2700200c5b9c 100644
> --- a/fs/file_attr.c
> +++ b/fs/file_attr.c
> @@ -15,12 +15,10 @@
>   * @fa:		fileattr pointer
>   * @xflags:	FS_XFLAG_* flags
>   *
> - * Set ->fsx_xflags, ->fsx_valid and ->flags (translated xflags).  All
> - * other fields are zeroed.
> + * Set ->fsx_xflags, ->fsx_valid and ->flags (translated xflags).
>   */
>  void fileattr_fill_xflags(struct file_kattr *fa, u32 xflags)
>  {
> -	memset(fa, 0, sizeof(*fa));
>  	fa->fsx_valid = true;
>  	fa->fsx_xflags = xflags;
>  	if (fa->fsx_xflags & FS_XFLAG_IMMUTABLE)
> @@ -46,11 +44,9 @@ EXPORT_SYMBOL(fileattr_fill_xflags);
>   * @flags:	FS_*_FL flags
>   *
>   * Set ->flags, ->flags_valid and ->fsx_xflags (translated flags).
> - * All other fields are zeroed.
>   */
>  void fileattr_fill_flags(struct file_kattr *fa, u32 flags)
>  {
> -	memset(fa, 0, sizeof(*fa));
>  	fa->flags_valid = true;
>  	fa->flags = flags;
>  	if (fa->flags & FS_SYNC_FL)
> @@ -84,6 +80,8 @@ int vfs_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
>  	struct inode *inode = d_inode(dentry);
>  	int error;
>  
> +	memset(fa, 0, sizeof(*fa));
> +

Umm, but ioctl_getflags() sets fa->flags_valid as a hint for
->fileattr_get() handler and this will now zero-out that hint. So I agree
that zeroing fa in fileattr_fill_{,x}flags() is a bit unexpected and moving
it is desirable but it needs a bit more careful surgery.

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ