Skip to contentSkip to conversation

fs fix for v5.19-rc3

GIT PULL Merged Christian Brauner 3 participants 4 messages Jun 15, 2022 – Jun 16, 2022

lore
Share & tools
lore
#0 lore raw

Hey Linus,

/* Summary */
This fixes an issue where we fail to change the group of a file when the caller owns the file and is a member of the group to change to. This is only relevant on idmapped mounts. This has originally been reported against [2]. There's a detailed description in the commit message and regression tests have been added to xfstests at [1].

/* Testing */
All patches are based on v5.19-rc1 and have been sitting in linux-next. No build failures or warnings were observed. The fstests, ltp, and associated selftests pass without regressions.

/* Conflicts */
At the time of creating this PR no merge conflicts were reported from linux-next and no merge conflicts showed up doing a test-merge with current mainline.

The following changes since commit f2906aa863381afb0015a9eb7fefad885d4e5a56:

Linux 5.19-rc1 (2022-06-05 17:18:54 -0700)

are available in the Git repository at:

[email protected]:pub/scm/linux/kernel/git/brauner/linux tags/fs.fixes.v5.19-rc3

for you to fetch changes up to 168f912893407a5acb798a4a58613b5f1f98c717:

fs: account for group membership (2022-06-14 12:18:47 +0200)

Please consider pulling these changes from the signed fs.fixes.v5.19-rc3 tag.

Thanks!
Christian

----------------------------------------------------------------
fs.fixes.v5.19-rc3

----------------------------------------------------------------
Christian Brauner (1):
fs: account for group membership

 fs/attr.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)
merge bot Merged
#1 lore raw
The pull request you sent on Wed, 15 Jun 2022 12:37:52 +0200:

The pull request you sent on Wed, 15 Jun 2022 12:37:52 +0200:

Quoted 1 line

[email protected]:pub/scm/linux/kernel/git/brauner/linux tags/fs.fixes.v5.19-rc3

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/979086f5e0066b4eff66e1eee123da228489985c

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
#2 lore raw
In reply to Christian Brauner
Quoted 4 lines · Christian Brauner

This fixes an issue where we fail to change the group of a file when the caller owns the file and is a member of the group to change to. This is only relevant on idmapped mounts.

Pulled, but this code makes me go "Eww".

I do get the feeling that maybe we should have some kind of static type help here, with "unmapped" and "filesystem mapped" uid/gid values having different types, the same way we have kuid_t vs uid_t for user-namespace mapping.

Because it feels like the problem here is that "kgid_t" has different meanings depending on context.

In fact, just within that one function, we have *three* very different kgid_t's:

- the argument to the function is a "kgid_t gid", which has *not*
been mapped into the filesystem mapping (why not?)

- the function itself declares a "kgid_t kgid", which is the inode
group ID mapped into the mount

- it how additionally has that thied "kgid_t mapped_gid", which is
the first 'gid' mapped into the mount

and honestly, I find that hugely confusing. The naming doesn't exactly clarify things either (ie "gid" is a "kgid_t", not a "git_t", and so is "kgid" - not helpful).

And being confusing with no type system support isn't a great thing.

So I'm wondering if <linux/mnt_idmapping.h> might be able to do the same kind of things we do in <linux/uidgid.h>.

NOTE: I did not look into just how hugely painful that would be. Maybe the above is the rantings of a madman.

Linus

#3 lore raw
Quoted 31 lines · Linus Torvalds
Quoted 4 lines · Christian Brauner

This fixes an issue where we fail to change the group of a file when the caller owns the file and is a member of the group to change to. This is only relevant on idmapped mounts.

Pulled, but this code makes me go "Eww".

I do get the feeling that maybe we should have some kind of static type help here, with "unmapped" and "filesystem mapped" uid/gid values having different types, the same way we have kuid_t vs uid_t for user-namespace mapping.

Because it feels like the problem here is that "kgid_t" has different meanings depending on context.

In fact, just within that one function, we have *three* very different kgid_t's:

- the argument to the function is a "kgid_t gid", which has *not*
been mapped into the filesystem mapping (why not?)

- the function itself declares a "kgid_t kgid", which is the inode
group ID mapped into the mount

- it how additionally has that thied "kgid_t mapped_gid", which is
the first 'gid' mapped into the mount

and honestly, I find that hugely confusing. The naming doesn't exactly clarify things either (ie "gid" is a "kgid_t", not a "git_t", and so is "kgid" - not helpful).

Quoted 7 lines

And being confusing with no type system support isn't a great thing.

So I'm wondering if <linux/mnt_idmapping.h> might be able to do the same kind of things we do in <linux/uidgid.h>.

NOTE: I did not look into just how hugely painful that would be. Maybe the above is the rantings of a madman.

I'm actually looking into this and have been for a while. I had thought about this from the start but just now have time to play with this!