Skip to contentSkip to conversation

fat: port to vfs{g,u}id_t and associated helpers

PATCH In review Christian Brauner 2 participants 7 messages Sep 9, 2022 – Sep 19, 2022

Subsystems (2)
lore
Share & tools
lore

Christian Brauner

author maintainer
#0 lore raw

PATCH 1/1 fat: port to vfs{g,u}id_t and associated helpers

A while ago we introduced a dedicated vfs{g,u}id_t type in commit 1e5267cd0895 ("mnt_idmapping: add vfs{g,u}id_t"). We already switched over a good part of the VFS. Ultimately we will remove all legacy idmapped mount helpers that operate only on k{g,u}id_t in favor of the new type safe helpers that operate on vfs{g,u}id_t.

Cc Seth Forshee (Digital Ocean) <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc OGAWA Hirofumi <[email protected]>
---
 fs/fat/file.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/fat/file.c +3 -2
index 3e4eb3467cb4..8a6b493b5b5f 100644
@@ -461,8 +461,9 @@ static int fat_allow_set_time(struct user_namespace *mnt_userns,
 {
 	umode_t allow_utime = sbi->options.allow_utime;
 
-	if (!uid_eq(current_fsuid(), i_uid_into_mnt(mnt_userns, inode))) {
-		if (in_group_p(i_gid_into_mnt(mnt_userns, inode)))
+	if (!vfsuid_eq_kuid(i_uid_into_vfsuid(mnt_userns, inode),
+			    current_fsuid())) {
+		if (vfsgid_in_group_p(i_gid_into_vfsgid(mnt_userns, inode)))
 			allow_utime >>= 3;
 		if (allow_utime & MAY_WRITE)
 			return 1;

base-commit: 7e18e42e4b280c85b76967a9106a13ca61c16179

Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Christian Brauner

A while ago we introduced a dedicated vfs{g,u}id_t type in commit 1e5267cd0895 ("mnt_idmapping: add vfs{g,u}id_t"). We already switched over a good part of the VFS. Ultimately we will remove all legacy idmapped mount helpers that operate only on k{g,u}id_t in favor of the new type safe helpers that operate on vfs{g,u}id_t.

If consistent with other parts in kernel, looks good.

Thanks.

Quoted 27 lines
Cc Seth Forshee (Digital Ocean) <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc OGAWA Hirofumi <[email protected]>
---
 fs/fat/file.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/fat/file.c +3 -2
index 3e4eb3467cb4..8a6b493b5b5f 100644
@@ -461,8 +461,9 @@ static int fat_allow_set_time(struct user_namespace *mnt_userns,
 {
 	umode_t allow_utime = sbi->options.allow_utime;
 
-	if (!uid_eq(current_fsuid(), i_uid_into_mnt(mnt_userns, inode))) {
-		if (in_group_p(i_gid_into_mnt(mnt_userns, inode)))
+	if (!vfsuid_eq_kuid(i_uid_into_vfsuid(mnt_userns, inode),
+			    current_fsuid())) {
+		if (vfsgid_in_group_p(i_gid_into_vfsgid(mnt_userns, inode)))
 			allow_utime >>= 3;
 		if (allow_utime & MAY_WRITE)
 			return 1;

base-commit: 7e18e42e4b280c85b76967a9106a13ca61c16179

Signature · 1 line
OGAWA Hirofumi <[email protected]>
author maintainer
#2 lore raw
Quoted 11 lines · OGAWA Hirofumi
Quoted 5 lines · Christian Brauner

A while ago we introduced a dedicated vfs{g,u}id_t type in commit 1e5267cd0895 ("mnt_idmapping: add vfs{g,u}id_t"). We already switched over a good part of the VFS. Ultimately we will remove all legacy idmapped mount helpers that operate only on k{g,u}id_t in favor of the new type safe helpers that operate on vfs{g,u}id_t.

If consistent with other parts in kernel, looks good.

Just to make sure: will you be taking this patch yourself or should I?

maintainer
#3 lore raw
Quoted 9 lines · Christian Brauner
Quoted 8 lines · OGAWA Hirofumi
Quoted 5 lines · Christian Brauner

A while ago we introduced a dedicated vfs{g,u}id_t type in commit 1e5267cd0895 ("mnt_idmapping: add vfs{g,u}id_t"). We already switched over a good part of the VFS. Ultimately we will remove all legacy idmapped mount helpers that operate only on k{g,u}id_t in favor of the new type safe helpers that operate on vfs{g,u}id_t.

Quoted 5 lines
Quoted 3 lines

If consistent with other parts in kernel, looks good.

Just to make sure: will you be taking this patch yourself or should I?

Ah, I was expecting almost all convert patches goes at once via you or vfs git. However, if you want this goes via me, please let me know.

Thanks.

Signature · 1 line
OGAWA Hirofumi <[email protected]>
author maintainer
#4 lore raw
Quoted 11 lines · OGAWA Hirofumi
Quoted 9 lines · Christian Brauner
Quoted 8 lines · OGAWA Hirofumi
Quoted 5 lines · Christian Brauner

A while ago we introduced a dedicated vfs{g,u}id_t type in commit 1e5267cd0895 ("mnt_idmapping: add vfs{g,u}id_t"). We already switched over a good part of the VFS. Ultimately we will remove all legacy idmapped mount helpers that operate only on k{g,u}id_t in favor of the new type safe helpers that operate on vfs{g,u}id_t.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

If consistent with other parts in kernel, looks good.

Just to make sure: will you be taking this patch yourself or should I?

Ah, I was expecting almost all convert patches goes at once via you or vfs git. However, if you want this goes via me, please let me know.

The patch is standalone which is why it would be great if you could just take it. :)

Thanks!
Christian

maintainer Acked-by
#5 lore raw
Quoted 8 lines · Christian Brauner
Quoted 4 lines · OGAWA Hirofumi

Christian Brauner <[email protected]> writes:

Ah, I was expecting almost all convert patches goes at once via you or vfs git. However, if you want this goes via me, please let me know.

The patch is standalone which is why it would be great if you could just take it. :)

Ok, Please queuing this patch, akpm.
Thanks.

From: Christian Brauner <[email protected]>
Subject: [PATCH] fat: port to vfs{g,u}id_t and associated helpers

A while ago we introduced a dedicated vfs{g,u}id_t type in commit 1e5267cd0895 ("mnt_idmapping: add vfs{g,u}id_t"). We already switched over a good part of the VFS. Ultimately we will remove all legacy idmapped mount helpers that operate only on k{g,u}id_t in favor of the new type safe helpers that operate on vfs{g,u}id_t.

---
 fs/fat/file.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/fat/file.c +3 -2
index 3e4eb3467cb4..8a6b493b5b5f 100644
@@ -461,8 +461,9 @@ static int fat_allow_set_time(struct user_namespace *mnt_userns,
 {
 	umode_t allow_utime = sbi->options.allow_utime;
 
-	if (!uid_eq(current_fsuid(), i_uid_into_mnt(mnt_userns, inode))) {
-		if (in_group_p(i_gid_into_mnt(mnt_userns, inode)))
+	if (!vfsuid_eq_kuid(i_uid_into_vfsuid(mnt_userns, inode),
+			    current_fsuid())) {
+		if (vfsgid_in_group_p(i_gid_into_vfsgid(mnt_userns, inode)))
 			allow_utime >>= 3;
 		if (allow_utime & MAY_WRITE)
 			return 1;

base-commit: 7e18e42e4b280c85b76967a9106a13ca61c16179

Signature · 3 lines
2.34.1
-- 
OGAWA Hirofumi <[email protected]>
author maintainer
#6 lore raw
Quoted 5 lines · OGAWA Hirofumi
Quoted 3 lines · Christian Brauner
Quoted 2 lines · OGAWA Hirofumi

Christian Brauner <[email protected]> writes:

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Ah, I was expecting almost all convert patches goes at once via you or vfs git. However, if you want this goes via me, please let me know.

The patch is standalone which is why it would be great if you could just take it. :)

Ok, Please queuing this patch, akpm.

Oh, I thought you had your own tree that's why I asked. Then nm, and I'll just pick it up.