linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
@ 2026-07-16  2:59 Zhan Xusheng
  2026-08-03  6:34 ` Chao Yu via Linux-f2fs-devel
  2026-08-05 21:20 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  0 siblings, 2 replies; 9+ messages in thread
From: Zhan Xusheng @ 2026-07-16  2:59 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu
  Cc: Christian Brauner, Zhan Xusheng, Jan Kara, linux-kernel, stable,
	linux-f2fs-devel, Pedro Falcato

f2fs_xattr_advise_set() calls inode_owner_or_capable() with &nop_mnt_idmap
before allowing the "system.advise" xattr to be set, instead of the idmap
that the VFS passes to the ->set() handler.

f2fs supports idmapped mounts, so on such a mount this checks the caller's
fsuid against the unmapped on-disk owner rather than the mapped owner: the
actual owner can be wrongly denied with -EPERM and an unrelated caller
wrongly allowed.  Pass the handler's idmap instead.

Fixes: 01beba7957a2 ("fs: port inode_owner_or_capable() to mnt_idmap")
Cc: stable@vger.kernel.org
Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
---
 fs/f2fs/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index ed33e5110f2a..6728d1488cad 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -119,7 +119,7 @@ static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
 	unsigned char old_advise = F2FS_I(inode)->i_advise;
 	unsigned char new_advise;
 
-	if (!inode_owner_or_capable(&nop_mnt_idmap, inode))
+	if (!inode_owner_or_capable(idmap, inode))
 		return -EPERM;
 	if (value == NULL)
 		return -EINVAL;
-- 
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
@ 2026-07-29  4:16 Rochan Avlur
  2026-07-30 10:23 ` Christian Brauner via Linux-f2fs-devel
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Rochan Avlur @ 2026-07-29  4:16 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu
  Cc: Christian Brauner, linux-kernel, stable, linux-f2fs-devel,
	Rochan Avlur, linux-fsdevel

f2fs_xattr_advise_set() calls inode_owner_or_capable() with
&nop_mnt_idmap before allowing the advise xattr to be set, instead of
the idmap that was passed into the handler.

Since f2fs supports idmapped mounts, this compares the caller's fsuid
against the unmapped on-disk owner rather than the mapped owner; resulting
in the actual owner to be wrongly denied with -EPERM. Use the idmap
argument that was already passed to the xattr handler instead.

Fixes: 984fc4e76d63 ("f2fs: support idmapped mounts")
Cc: stable@vger.kernel.org
Signed-off-by: Rochan Avlur <rochan.avlur@gmail.com>
---
 fs/f2fs/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 610d5810074d..281e2fd6c778 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -118,7 +118,7 @@ static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
 	unsigned char old_advise = F2FS_I(inode)->i_advise;
 	unsigned char new_advise;
 
-	if (!inode_owner_or_capable(&nop_mnt_idmap, inode))
+	if (!inode_owner_or_capable(idmap, inode))
 		return -EPERM;
 	if (value == NULL)
 		return -EINVAL;
-- 
2.45.2



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
  2026-07-29  4:16 Rochan Avlur
@ 2026-07-30 10:23 ` Christian Brauner via Linux-f2fs-devel
  2026-08-03 23:33   ` Jaegeuk Kim via Linux-f2fs-devel
  2026-08-03  8:40 ` Chao Yu via Linux-f2fs-devel
  2026-08-05 21:20 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  2 siblings, 1 reply; 9+ messages in thread
From: Christian Brauner via Linux-f2fs-devel @ 2026-07-30 10:23 UTC (permalink / raw)
  To: Rochan Avlur
  Cc: Christian Brauner, linux-kernel, stable, linux-f2fs-devel,
	linux-fsdevel, Jaegeuk Kim

Hi Rochan,

> f2fs_xattr_advise_set() calls inode_owner_or_capable() with
> &nop_mnt_idmap before allowing the advise xattr to be set, instead of
> the idmap that was passed into the handler.
> 
> Since f2fs supports idmapped mounts, this compares the caller's fsuid
> against the unmapped on-disk owner rather than the mapped owner; resulting
> in the actual owner to be wrongly denied with -EPERM. Use the idmap
> argument that was already passed to the xattr handler instead.
> 
> Fixes: 984fc4e76d63 ("f2fs: support idmapped mounts")
> Cc: stable@vger.kernel.org
> Signed-off-by: Rochan Avlur <rochan.avlur@gmail.com>

Seems generally fine to me,
Acked-by: Christian Brauner (Amutable) <braurg>

-- 



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
  2026-07-16  2:59 [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set() Zhan Xusheng
@ 2026-08-03  6:34 ` Chao Yu via Linux-f2fs-devel
  2026-08-05 21:20 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  1 sibling, 0 replies; 9+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2026-08-03  6:34 UTC (permalink / raw)
  To: Zhan Xusheng, Jaegeuk Kim
  Cc: Christian Brauner, Zhan Xusheng, Jan Kara, linux-kernel, stable,
	linux-f2fs-devel, Pedro Falcato

On 7/16/26 10:59, Zhan Xusheng wrote:
> f2fs_xattr_advise_set() calls inode_owner_or_capable() with &nop_mnt_idmap
> before allowing the "system.advise" xattr to be set, instead of the idmap
> that the VFS passes to the ->set() handler.
> 
> f2fs supports idmapped mounts, so on such a mount this checks the caller's
> fsuid against the unmapped on-disk owner rather than the mapped owner: the
> actual owner can be wrongly denied with -EPERM and an unrelated caller
> wrongly allowed.  Pass the handler's idmap instead.
> 
> Fixes: 01beba7957a2 ("fs: port inode_owner_or_capable() to mnt_idmap")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
  2026-07-29  4:16 Rochan Avlur
  2026-07-30 10:23 ` Christian Brauner via Linux-f2fs-devel
@ 2026-08-03  8:40 ` Chao Yu via Linux-f2fs-devel
  2026-08-03 13:43   ` Rochan Avlur
  2026-08-05 21:20 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  2 siblings, 1 reply; 9+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2026-08-03  8:40 UTC (permalink / raw)
  To: Rochan Avlur, Jaegeuk Kim
  Cc: Christian Brauner, linux-kernel, stable, linux-f2fs-devel,
	linux-fsdevel

On 7/29/26 12:16, Rochan Avlur wrote:
> f2fs_xattr_advise_set() calls inode_owner_or_capable() with
> &nop_mnt_idmap before allowing the advise xattr to be set, instead of
> the idmap that was passed into the handler.
> 
> Since f2fs supports idmapped mounts, this compares the caller's fsuid
> against the unmapped on-disk owner rather than the mapped owner; resulting
> in the actual owner to be wrongly denied with -EPERM. Use the idmap
> argument that was already passed to the xattr handler instead.
> 
> Fixes: 984fc4e76d63 ("f2fs: support idmapped mounts")
> Cc: stable@vger.kernel.org
> Signed-off-by: Rochan Avlur <rochan.avlur@gmail.com>

Thanks for the patch.

I notice there is already a patch:

https://lore.kernel.org/linux-f2fs-devel/20260716025908.608098-1-zhanxusheng@xiaomi.com

Thanks,

> ---
>   fs/f2fs/xattr.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
> index 610d5810074d..281e2fd6c778 100644
> --- a/fs/f2fs/xattr.c
> +++ b/fs/f2fs/xattr.c
> @@ -118,7 +118,7 @@ static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
>   	unsigned char old_advise = F2FS_I(inode)->i_advise;
>   	unsigned char new_advise;
>   
> -	if (!inode_owner_or_capable(&nop_mnt_idmap, inode))
> +	if (!inode_owner_or_capable(idmap, inode))
>   		return -EPERM;
>   	if (value == NULL)
>   		return -EINVAL;



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
  2026-08-03  8:40 ` Chao Yu via Linux-f2fs-devel
@ 2026-08-03 13:43   ` Rochan Avlur
  0 siblings, 0 replies; 9+ messages in thread
From: Rochan Avlur @ 2026-08-03 13:43 UTC (permalink / raw)
  To: Chao Yu
  Cc: Christian Brauner, linux-kernel, stable, linux-f2fs-devel,
	linux-fsdevel, Jaegeuk Kim

Hi Chao,

> > f2fs_xattr_advise_set() calls inode_owner_or_capable() with
> > &nop_mnt_idmap before allowing the advise xattr to be set, instead of
> > the idmap that was passed into the handler.
> >
> > Since f2fs supports idmapped mounts, this compares the caller's fsuid
> > against the unmapped on-disk owner rather than the mapped owner; resulting
> > in the actual owner to be wrongly denied with -EPERM. Use the idmap
> > argument that was already passed to the xattr handler instead.
> >
> > Fixes: 984fc4e76d63 ("f2fs: support idmapped mounts")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Rochan Avlur <rochan.avlur@gmail.com>
>
> Thanks for the patch.
>
> I notice there is already a patch:
>
> https://lore.kernel.org/linux-f2fs-devel/20260716025908.608098-1-zhanxusheng@xiaomi.com

Thanks for pointing that out. I wasn't aware of Zhan's patch when I
submitted mine. Happy to defer to the earlier submission.


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
  2026-07-30 10:23 ` Christian Brauner via Linux-f2fs-devel
@ 2026-08-03 23:33   ` Jaegeuk Kim via Linux-f2fs-devel
  0 siblings, 0 replies; 9+ messages in thread
From: Jaegeuk Kim via Linux-f2fs-devel @ 2026-08-03 23:33 UTC (permalink / raw)
  To: Christian Brauner
  Cc: linux-fsdevel, Rochan Avlur, linux-kernel, stable,
	linux-f2fs-devel

On 07/30, Christian Brauner via Linux-f2fs-devel wrote:
> Hi Rochan,
> 
> > f2fs_xattr_advise_set() calls inode_owner_or_capable() with
> > &nop_mnt_idmap before allowing the advise xattr to be set, instead of
> > the idmap that was passed into the handler.
> > 
> > Since f2fs supports idmapped mounts, this compares the caller's fsuid
> > against the unmapped on-disk owner rather than the mapped owner; resulting
> > in the actual owner to be wrongly denied with -EPERM. Use the idmap
> > argument that was already passed to the xattr handler instead.
> > 
> > Fixes: 984fc4e76d63 ("f2fs: support idmapped mounts")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Rochan Avlur <rochan.avlur@gmail.com>
> 
> Seems generally fine to me,
> Acked-by: Christian Brauner (Amutable) <braurg>

Thanks, let me applied Acked-by: to the first submitted patch, which is same.

> 
> -- 
> 
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
  2026-07-16  2:59 [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set() Zhan Xusheng
  2026-08-03  6:34 ` Chao Yu via Linux-f2fs-devel
@ 2026-08-05 21:20 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  1 sibling, 0 replies; 9+ messages in thread
From: patchwork-bot+f2fs--- via Linux-f2fs-devel @ 2026-08-05 21:20 UTC (permalink / raw)
  To: Zhan Xusheng
  Cc: brauner, zhanxusheng, jack, linux-kernel, stable,
	linux-f2fs-devel, pfalcato, jaegeuk

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Thu, 16 Jul 2026 10:59:08 +0800 you wrote:
> f2fs_xattr_advise_set() calls inode_owner_or_capable() with &nop_mnt_idmap
> before allowing the "system.advise" xattr to be set, instead of the idmap
> that the VFS passes to the ->set() handler.
> 
> f2fs supports idmapped mounts, so on such a mount this checks the caller's
> fsuid against the unmapped on-disk owner rather than the mapped owner: the
> actual owner can be wrongly denied with -EPERM and an unrelated caller
> wrongly allowed.  Pass the handler's idmap instead.
> 
> [...]

Here is the summary with links:
  - [f2fs-dev] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
    https://git.kernel.org/jaegeuk/f2fs/c/a54ffce4637a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
  2026-07-29  4:16 Rochan Avlur
  2026-07-30 10:23 ` Christian Brauner via Linux-f2fs-devel
  2026-08-03  8:40 ` Chao Yu via Linux-f2fs-devel
@ 2026-08-05 21:20 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  2 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+f2fs--- via Linux-f2fs-devel @ 2026-08-05 21:20 UTC (permalink / raw)
  To: Rochan Avlur
  Cc: brauner, linux-kernel, stable, linux-f2fs-devel, linux-fsdevel,
	jaegeuk

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Tue, 28 Jul 2026 21:16:56 -0700 you wrote:
> f2fs_xattr_advise_set() calls inode_owner_or_capable() with
> &nop_mnt_idmap before allowing the advise xattr to be set, instead of
> the idmap that was passed into the handler.
> 
> Since f2fs supports idmapped mounts, this compares the caller's fsuid
> against the unmapped on-disk owner rather than the mapped owner; resulting
> in the actual owner to be wrongly denied with -EPERM. Use the idmap
> argument that was already passed to the xattr handler instead.
> 
> [...]

Here is the summary with links:
  - [f2fs-dev] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
    https://git.kernel.org/jaegeuk/f2fs/c/a54ffce4637a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-08-05 21:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16  2:59 [f2fs-dev] [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set() Zhan Xusheng
2026-08-03  6:34 ` Chao Yu via Linux-f2fs-devel
2026-08-05 21:20 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  -- strict thread matches above, loose matches on Subject: below --
2026-07-29  4:16 Rochan Avlur
2026-07-30 10:23 ` Christian Brauner via Linux-f2fs-devel
2026-08-03 23:33   ` Jaegeuk Kim via Linux-f2fs-devel
2026-08-03  8:40 ` Chao Yu via Linux-f2fs-devel
2026-08-03 13:43   ` Rochan Avlur
2026-08-05 21:20 ` patchwork-bot+f2fs--- via Linux-f2fs-devel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).