Skip to content

Support idmapped mount #2307

Open
0 of 2 issues completed
Open

Sub-issues

Sub-issues

0 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. utam0k commented on Jan 18, 2024

    @utam0k
    MemberAuthor

    @lengrongfu Do you have an interest in this issue? This is not simple, but it would be good to learn container runtime.

  2. lengrongfu commented on Jan 18, 2024

    @lengrongfu
    Collaborator

    @lengrongfu Do you have an interest in this issue? This is not simple, but it would be good to learn container runtime.

    Thanks, i can.

  3. lengrongfu commented on Jan 18, 2024

    @lengrongfu
    Collaborator

    /assign

  4. utam0k commented on Jan 26, 2024

    @utam0k
    MemberAuthor

    @lengrongfu Thanks. I'm looking forward to seeing your PR. It will be a wonderful feature.

  5. YamasouA commented on Sep 22, 2025

    @YamasouA
    Contributor

    Hey @lengrongfu
    I’m also interested in this issue. Are you still working on it?
    If not, I’d be happy to pick it up and continue.

  6. YamasouA commented on Feb 28, 2026

    @YamasouA
    Contributor

    Summary:

    • idmap/ridmap mounts are validated to be bind mounts and require both uid/gid mappings.
    • During rootfs setup, Init requests an idmapped mount fd from Main via the channel.
    • Main creates a short‑lived UserNS helper, writes uid/gid maps (and setgroups=deny if needed), opens the UserNS fd, then runs open_tree + mount_setattr to create an idmapped mount fd.
    • The mount fd is sent back to Init, which performs move_mount to the destination and applies any remount/recursive attributes.
    • userns_fd can be dropped after mount_setattr; the idmapped mount remains valid.

    Sequence Diagram

    sequenceDiagram
    participant Init as "Youki (Init Process)"
    participant Main as "Youki (Main Process)"
    participant Helper as "UserNS helper (CLONE_NEWUSER)"
    
    Init->>Init: validate spec (idmap/ridmap requires bind + uid/gid mappings)
    Main->>Main: wait for MountFdPlease
    Init->>Main: MountFdPlease(MountMsg{source,idmap,recursive})
    
    Main->>Helper: fork()
    activate Helper
    Helper->>Helper: unshare(CLONE_NEWUSER)
    Helper->>Helper: wait for pipe (keeps userns alive)
    Main->>Main: write /proc/<pid>/uid_map, gid_map
    Main->>Main: open /proc/<pid>/ns/user (userns_fd)
    
    Main->>Main: open_tree(source, flags)
    Main->>Main: mount_setattr(MOUNT_ATTR_IDMAP, userns_fd)
    Main->>Main: drop userns_fd (UserNS closes)
    Main-->>Init: MountFdReply (mount_fd)
    Init->>Init: move_mount(mount_fd, dest)
    
    Loading
  7. added this to the v1.0.0 milestone on Mar 30, 2026
  8. reopened this on May 29, 2026
  9. reopened this on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions