Problem Statement
Running Podman sandbox containers with user namespace isolation (--userns=auto) improves security by mapping container UIDs to unprivileged host UID ranges. The Podman driver currently has no way to configure the user namespace mode, and the supervisor binary injection via image volumes is incompatible with user namespaces because the kernel does not support idmapped mounts on overlay filesystems (and supporting it in Podman is not trivial as we need to apply the idmap to the lower layers).
Proposed Design
Add a userns string field to PodmanComputeConfig. When set to "auto", the driver sets idmappings.AutoUserNs = true alongside userns.nsmode, and falls back to extracting the supervisor binary from the image to a host-side cache and bind-mounting it, because Podman image volumes use overlay mounts and overlay does not support idmapped mounts.
▎
Alternatives Considered
Support idmap for image mounts in Podman, but this is not trivial, and will need a new Podman release.
Agent Investigation
Verified on kernel 7.2.0-rc2 that mount_setattr on overlay merge dirs returns EINVAL. Confirmed idmap works on regular bind mounts. Modeled extraction flow after the Docker driver's extract_supervisor_bin_from_image().
Checklist
Problem Statement
Running Podman sandbox containers with user namespace isolation (--userns=auto) improves security by mapping container UIDs to unprivileged host UID ranges. The Podman driver currently has no way to configure the user namespace mode, and the supervisor binary injection via image volumes is incompatible with user namespaces because the kernel does not support idmapped mounts on overlay filesystems (and supporting it in Podman is not trivial as we need to apply the idmap to the lower layers).
Proposed Design
Add a userns string field to PodmanComputeConfig. When set to "auto", the driver sets idmappings.AutoUserNs = true alongside userns.nsmode, and falls back to extracting the supervisor binary from the image to a host-side cache and bind-mounting it, because Podman image volumes use overlay mounts and overlay does not support idmapped mounts.
▎
Alternatives Considered
Support idmap for image mounts in Podman, but this is not trivial, and will need a new Podman release.
Agent Investigation
Verified on kernel 7.2.0-rc2 that mount_setattr on overlay merge dirs returns EINVAL. Confirmed idmap works on regular bind mounts. Modeled extraction flow after the Docker driver's extract_supervisor_bin_from_image().
Checklist