Skip to contentSkip to conversation

f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()

PATCH Applied Rochan Avlur 5 participants 6 messages Jul 29 – Aug 5

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()

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")
---
 fs/f2fs/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/xattr.c +1 -1
index 610d5810074d..281e2fd6c778 100644
@@ -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;
Signature · 1 line
2.45.2
#1 lore raw

Hi Rochan,

Quoted 4 lines

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.

Quoted 8 lines

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")

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

maintainer
#2 lore raw
Quoted 11 lines · On 07/30, Christian Brauner via Linux-f2fs-devel wrote:

Hi Rochan,

Quoted 9 lines

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.

Quoted 6 lines
Quoted 3 lines
Fixes 984fc4e76d63 ("f2fs: support idmapped mounts")

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.

Quoted 9 lines
Signature · 8 lines
-- 



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
maintainer
#3 lore raw
In reply to Rochan Avlur
Quoted 4 lines · Rochan Avlur

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.

Quoted 8 lines

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")

Thanks for the patch.

I notice there is already a patch:

https://lore.kernel.org/linux-f2fs-devel/[email protected]

Thanks,

Quoted 17 lines
---
  fs/f2fs/xattr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/xattr.c +1 -1
index 610d5810074d..281e2fd6c778 100644
@@ -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;
#4 lore raw

Hi Chao,

Quoted 13 lines
Quoted 4 lines

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.

Quoted 8 lines

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")
Quoted 5 lines

Thanks for the patch.

I notice there is already a patch:

https://lore.kernel.org/linux-f2fs-devel/[email protected]

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

#5 lore raw
In reply to Rochan Avlur
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 10 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html