idmapped mounts

Started by Christian Brauner on Jan 12, 2021 · 82 messages from 7 authors · Last reply Jan 20, 2021

Series

42 patches, 353 files

+13,337 −1,881

Subsystems (95)

Show 92 more

Maintainers (134)

Show 130 more
STALE2125d SUPERSEDED

Status: Superseded by v6 (posted 2021-01-21). [go to v6]

Revision v5 (4 revisions archived).

Revisions (4)
  1. v3
  2. v4 [diff against previous]
  3. v5 current [diff against previous]
  4. v6 [diff against previous]

page 2 of 2 · open the first message on its own page

  1. [PATCH v5 02/42] mount: make {lock,unlock}_mount_hash() static
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  2. [PATCH v5 03/42] namespace: only take read lock in do_reconfigure_mnt()
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  3. [PATCH v5 04/42] fs: split out functions to hold writers
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  4. [PATCH v5 05/42] fs: add attr_flags_to_mnt_flags helper
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  5. [PATCH v5 06/42] fs: add mount_setattr()
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  6. [PATCH v5 09/42] mount: attach mappings to mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  7. [PATCH v5 10/42] capability: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  8. [PATCH v5 07/42] tests: add mount_setattr() selftests
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  9. [PATCH v5 12/42] inode: make init and permission helpers idmapped mount aware
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  10. [PATCH v5 11/42] namei: make permission helpers idmapped mount aware
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  11. [PATCH v5 08/42] fs: add id translation helpers
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  12. [PATCH v5 17/42] commoncap: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  13. [PATCH v5 14/42] acl: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  14. [PATCH v5 19/42] namei: handle idmapped mounts in may_*() helpers
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  15. [PATCH v5 18/42] stat: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  16. [PATCH v5 16/42] xattr: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  17. [PATCH v5 13/42] attr: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  18. [PATCH v5 01/42] namespace: take lock_mount_hash() directly when changing flags
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  19. [PATCH v5 15/42] fs: add file_user_ns() helper
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  20. [PATCH v5 20/42] namei: introduce struct renamedata
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  21. [PATCH v5 42/42] generic/622: add fstests for idmapped mounts
    Related patches
  22. [PATCH v5 39/42] overlayfs: do not mount on top of idmapped mounts
    Revisions and related patches
    Revisions (3)
    1. v4
    2. v5 current [diff against previous]
    3. v6 [diff against previous]
  23. [PATCH v5 41/42] tests: extend mount_setattr tests
    Related patches
  24. [PATCH v5 21/42] namei: prepare for idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  25. [PATCH v5 34/42] ima: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  26. [PATCH v5 30/42] would_dump: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  27. [PATCH v5 32/42] fs: make helpers idmap mount aware
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  28. [PATCH v5 23/42] open: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  29. [PATCH v5 38/42] ecryptfs: do not mount on top of idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  30. [PATCH v5 26/42] fcntl: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  31. [PATCH v5 33/42] apparmor: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  32. [PATCH v5 28/42] init: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  33. [PATCH v5 25/42] utimes: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  34. [PATCH v5 31/42] exec: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  35. [PATCH v5 37/42] xfs: support idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  36. [PATCH v5 29/42] ioctl: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  37. [PATCH v5 36/42] ext4: support idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  38. [PATCH v5 22/42] open: handle idmapped mounts in do_truncate()
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  39. [PATCH v5 40/42] fs: introduce MOUNT_ATTR_IDMAP
    Revisions and related patches
    Revisions (3)
    1. v4
    2. v5 current [diff against previous]
    3. v6 [diff against previous]
  40. [PATCH v5 27/42] notify: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  41. [PATCH v5 24/42] af_unix: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]
  42. [PATCH v5 35/42] fat: handle idmapped mounts
    Revisions and related patches
    Revisions (4)
    1. v3
    2. v4 [diff against previous]
    3. v5 current [diff against previous]
    4. v6 [diff against previous]

Re: [PATCH v5 15/42] fs: add file_user_ns() helper

Message details and related content
On Tue, Jan 12, 2021 at 11:00:57PM +0100, Christian Brauner wrote:
Add a simple helper to retrieve the user namespace associated with the
vfsmount of a file. Christoph correctly points out that this makes
codepaths (e.g. ioctls) way easier to follow that would otherwise
dereference via mnt_user_ns(file->f_path.mnt).

In order to make file_user_ns() static inline we'd need to include
mount.h in either file.h or fs.h which seems undesirable so let's simply
not force file_user_ns() to be inline.
I'd be tempted to just make this an inline.

Otherwise this looks ok:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH v5 12/42] inode: make init and permission helpers idmapped mount aware

Message details and related content
quoted hunk
@@ -1761,8 +1761,8 @@ static inline bool sb_start_intwrite_trylock(struct super_block *sb)
 	return __sb_start_write_trylock(sb, SB_FREEZE_FS);
 }
 
-
-extern bool inode_owner_or_capable(const struct inode *inode);
+extern bool inode_owner_or_capable(struct user_namespace *mnt_userns,
+				   const struct inode *inode);
While you're at it - it would be nice to drop the superflous externs in
the headers.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH v5 11/42] namei: make permission helpers idmapped mount aware

Message details and related content
On Tue, Jan 12, 2021 at 11:00:53PM +0100, Christian Brauner wrote:
The two helpers inode_permission() and generic_permission() are used by
the vfs to perform basic permission checking by verifying that the
caller is privileged over an inode. In order to handle idmapped mounts
we extend the two helpers with an additional user namespace argument.
On idmapped mounts the two helpers will make sure to map the inode
according to the mount's user namespace and then peform identical
permission checks to inode_permission() and generic_permission(). If the
initial user namespace is passed nothing changes so non-idmapped mounts
will see identical behavior as before.
More long lines in here.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH v5 10/42] capability: handle idmapped mounts

Message details and related content
On Tue, Jan 12, 2021 at 11:00:52PM +0100, Christian Brauner wrote:
In order to determine whether a caller holds privilege over a given
inode the capability framework exposes the two helpers
privileged_wrt_inode_uidgid() and capable_wrt_inode_uidgid(). The former
verifies that the inode has a mapping in the caller's user namespace and
the latter additionally verifies that the caller has the requested
capability in their current user namespace.
If the inode is accessed through an idmapped mount we simply need to map
it according to the mount's user namespace. Afterwards the checks are
identical to non-idmapped inodes. If the initial user namespace is
passed all operations are a nop so non-idmapped mounts will not see a
change in behavior and will also not see any performance impact.
This adds a bunch of pointless > 80 char lines, that would be nice to
fix up.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH v5 15/42] fs: add file_user_ns() helper

Message details and related content
On Tue, Jan 19, 2021 at 04:05:00PM +0100, Jann Horn wrote:
On Wed, Jan 13, 2021 at 1:52 AM Christian Brauner
[off-list ref] wrote:
quoted
Add a simple helper to retrieve the user namespace associated with the
vfsmount of a file. Christoph correctly points out that this makes
codepaths (e.g. ioctls) way easier to follow that would otherwise
dereference via mnt_user_ns(file->f_path.mnt).

In order to make file_user_ns() static inline we'd need to include
mount.h in either file.h or fs.h which seems undesirable so let's simply
not force file_user_ns() to be inline.
[...]
quoted
+struct user_namespace *file_user_ns(struct file *file)
+{
+       return mnt_user_ns(file->f_path.mnt);
+}
That name is confusing to me, because when I think of "the userns of a
file", it's file->f_cred->user_ns. There are a bunch of places that
look at that, as you can see from grepping for "f_cred->user_ns".

If you really want this to be a separate helper, can you maybe give it
a clearer name? file_mnt_user_ns(), or something like that, idk.
Done.

Previous page

Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help