* [PATCH] fs: reset read-only fsflags together with xflags
@ 2026-01-21 19:36 Andrey Albershteyn
2026-01-22 9:40 ` Jan Kara
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andrey Albershteyn @ 2026-01-21 19:36 UTC (permalink / raw)
To: brauner, jack, linux-fsdevel, linux-kernel
Cc: Andrey Albershteyn, Eric Biggers
While setting file attributes, the read-only flags are reset
for ->xflags, but not for ->flags if flag is shared between both. This
is fine for now as all read-only xflags don't overlap with flags.
However, for any read-only shared flag this will create inconsistency
between xflags and flags. The non-shared flag will be reset in
vfs_fileattr_set() to the current value, but shared one is past further
to ->fileattr_set.
Reported-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
---
The shared read-only flag is going to be added for fsverity. The one for ->flags
already exists.
[1]: https://lore.kernel.org/linux-xfs/20260119165644.2945008-2-aalbersh@kernel.org/
---
fs/file_attr.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/file_attr.c b/fs/file_attr.c
index 13cdb31a3e94..bed5442fa6fa 100644
--- a/fs/file_attr.c
+++ b/fs/file_attr.c
@@ -142,8 +142,7 @@ static int file_attr_to_fileattr(const struct file_attr *fattr,
if (fattr->fa_xflags & ~mask)
return -EINVAL;
- fileattr_fill_xflags(fa, fattr->fa_xflags);
- fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;
+ fileattr_fill_xflags(fa, fattr->fa_xflags & ~FS_XFLAG_RDONLY_MASK);
fa->fsx_extsize = fattr->fa_extsize;
fa->fsx_projid = fattr->fa_projid;
fa->fsx_cowextsize = fattr->fa_cowextsize;
@@ -163,8 +162,7 @@ static int copy_fsxattr_from_user(struct file_kattr *fa,
if (xfa.fsx_xflags & ~mask)
return -EOPNOTSUPP;
- fileattr_fill_xflags(fa, xfa.fsx_xflags);
- fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;
+ fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FS_XFLAG_RDONLY_MASK);
fa->fsx_extsize = xfa.fsx_extsize;
fa->fsx_nextents = xfa.fsx_nextents;
fa->fsx_projid = xfa.fsx_projid;
--
2.52.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] fs: reset read-only fsflags together with xflags
2026-01-21 19:36 [PATCH] fs: reset read-only fsflags together with xflags Andrey Albershteyn
@ 2026-01-22 9:40 ` Jan Kara
2026-01-23 14:55 ` Christian Brauner
2026-01-24 18:29 ` Eric Biggers
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2026-01-22 9:40 UTC (permalink / raw)
To: Andrey Albershteyn
Cc: brauner, jack, linux-fsdevel, linux-kernel, Eric Biggers
On Wed 21-01-26 20:36:43, Andrey Albershteyn wrote:
> While setting file attributes, the read-only flags are reset
> for ->xflags, but not for ->flags if flag is shared between both. This
> is fine for now as all read-only xflags don't overlap with flags.
> However, for any read-only shared flag this will create inconsistency
> between xflags and flags. The non-shared flag will be reset in
> vfs_fileattr_set() to the current value, but shared one is past further
^^ passed
> to ->fileattr_set.
>
> Reported-by: Eric Biggers <ebiggers@kernel.org>
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
>
> The shared read-only flag is going to be added for fsverity. The one for ->flags
> already exists.
>
> [1]: https://lore.kernel.org/linux-xfs/20260119165644.2945008-2-aalbersh@kernel.org/
>
> ---
> fs/file_attr.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/file_attr.c b/fs/file_attr.c
> index 13cdb31a3e94..bed5442fa6fa 100644
> --- a/fs/file_attr.c
> +++ b/fs/file_attr.c
> @@ -142,8 +142,7 @@ static int file_attr_to_fileattr(const struct file_attr *fattr,
> if (fattr->fa_xflags & ~mask)
> return -EINVAL;
>
> - fileattr_fill_xflags(fa, fattr->fa_xflags);
> - fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;
> + fileattr_fill_xflags(fa, fattr->fa_xflags & ~FS_XFLAG_RDONLY_MASK);
> fa->fsx_extsize = fattr->fa_extsize;
> fa->fsx_projid = fattr->fa_projid;
> fa->fsx_cowextsize = fattr->fa_cowextsize;
> @@ -163,8 +162,7 @@ static int copy_fsxattr_from_user(struct file_kattr *fa,
> if (xfa.fsx_xflags & ~mask)
> return -EOPNOTSUPP;
>
> - fileattr_fill_xflags(fa, xfa.fsx_xflags);
> - fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;
> + fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FS_XFLAG_RDONLY_MASK);
> fa->fsx_extsize = xfa.fsx_extsize;
> fa->fsx_nextents = xfa.fsx_nextents;
> fa->fsx_projid = xfa.fsx_projid;
> --
> 2.52.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fs: reset read-only fsflags together with xflags
2026-01-21 19:36 [PATCH] fs: reset read-only fsflags together with xflags Andrey Albershteyn
2026-01-22 9:40 ` Jan Kara
@ 2026-01-23 14:55 ` Christian Brauner
2026-01-24 18:29 ` Eric Biggers
2 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2026-01-23 14:55 UTC (permalink / raw)
To: Andrey Albershteyn
Cc: Christian Brauner, Eric Biggers, jack, linux-fsdevel, linux-kernel
On Wed, 21 Jan 2026 20:36:43 +0100, Andrey Albershteyn wrote:
> While setting file attributes, the read-only flags are reset
> for ->xflags, but not for ->flags if flag is shared between both. This
> is fine for now as all read-only xflags don't overlap with flags.
> However, for any read-only shared flag this will create inconsistency
> between xflags and flags. The non-shared flag will be reset in
> vfs_fileattr_set() to the current value, but shared one is past further
> to ->fileattr_set.
>
> [...]
Applied to the vfs-7.0.misc branch of the vfs/vfs.git tree.
Patches in the vfs-7.0.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.0.misc
[1/1] fs: reset read-only fsflags together with xflags
https://git.kernel.org/vfs/vfs/c/9396bfdacb5a
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] fs: reset read-only fsflags together with xflags
2026-01-21 19:36 [PATCH] fs: reset read-only fsflags together with xflags Andrey Albershteyn
2026-01-22 9:40 ` Jan Kara
2026-01-23 14:55 ` Christian Brauner
@ 2026-01-24 18:29 ` Eric Biggers
2 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers @ 2026-01-24 18:29 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: brauner, jack, linux-fsdevel, linux-kernel
On Wed, Jan 21, 2026 at 08:36:43PM +0100, Andrey Albershteyn wrote:
> While setting file attributes, the read-only flags are reset
> for ->xflags, but not for ->flags if flag is shared between both. This
> is fine for now as all read-only xflags don't overlap with flags.
> However, for any read-only shared flag this will create inconsistency
> between xflags and flags. The non-shared flag will be reset in
> vfs_fileattr_set() to the current value, but shared one is past further
> to ->fileattr_set.
>
> Reported-by: Eric Biggers <ebiggers@kernel.org>
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
> ---
>
> The shared read-only flag is going to be added for fsverity. The one for ->flags
> already exists.
>
> [1]: https://lore.kernel.org/linux-xfs/20260119165644.2945008-2-aalbersh@kernel.org/
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
- Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-24 18:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-21 19:36 [PATCH] fs: reset read-only fsflags together with xflags Andrey Albershteyn
2026-01-22 9:40 ` Jan Kara
2026-01-23 14:55 ` Christian Brauner
2026-01-24 18:29 ` Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®