spiegel_podman/libpod
Lokesh Mandvekar a85faf236d
Fix userns=auto failures in rootless mode
(cherry picked from commit ca1a0db4e7)

This commit fixes three related issues that prevented userns=auto from
working correctly in rootless containers:

1. Fix setgroups() error with userns=auto
   When using userns=auto, supplementary GIDs from the container image
   were being passed to setgroups() before user namespace mappings were
   allocated by storage, causing EINVAL errors. Added a check in
   container_internal_common.go to skip supplementary groups when
   AutoUserNs is enabled but GIDMap isn't populated yet.

2. Fix ID mapping allocation bug in storage.go
   CreateContainerStorage was returning empty UID/GID mappings from the
   input options parameter instead of the allocated mappings from the
   storage container object, causing containers to fail with "readlink:
   No such file or directory" errors. Changed the return statement to
   use container.UIDMap and container.GIDMap.

3. Add workaround for containers/storage v1.51.0 bug
   The vendored storage library has a bug in parseMountedFiles where
   groupFile path is incorrectly used as a directory path. Set an
   explicit Size=65536 in AutoUserNsOpts to bypass the buggy code path.

With these fixes, all userns=auto tests in 170-run-userns.bats now pass
in rootless mode.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-03-30 15:13:31 -04:00
..
define Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
driver bump go module to version 4 2022-01-18 12:47:07 +01:00
events fix goroutine leaks in events and logs backend 2022-07-26 13:54:28 -04:00
layers Initial checkin from CRI-O repo 2017-11-01 11:24:59 -04:00
linkmode go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
lock libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
logs libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
plugin Add support for containers.conf volume timeouts 2022-10-06 15:07:10 -04:00
shutdown libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
boltdb_state.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
boltdb_state_internal.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
boltdb_state_linux.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
common_test.go bump go module to version 4 2022-01-18 12:47:07 +01:00
container.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
container_api.go container wait: improve error message 2022-07-26 14:40:52 -04:00
container_commit.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
container_config.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
container_copy_linux.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
container_exec.go [v4.2.0-rhel] all: stop using deprecated GenerateNonCryptoID 2023-02-01 16:35:50 -05:00
container_graph.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
container_graph_test.go bump go module to version 4 2022-01-18 12:47:07 +01:00
container_inspect.go health check: add on-failure actions 2022-09-27 10:40:36 +02:00
container_inspect_linux.go Adjust for common bump 2026-01-28 10:48:05 -05:00
container_internal.go Fix userns=auto failures in rootless mode 2026-03-30 15:13:31 -04:00
container_internal_common.go Fix userns=auto failures in rootless mode 2026-03-30 15:13:31 -04:00
container_internal_linux.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
container_internal_linux_test.go test: use T.TempDir to create temporary test directory 2022-05-05 21:09:41 +08:00
container_internal_test.go test: fix failing TestPostDeleteHooks 2022-05-05 21:39:46 +08:00
container_linux.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
container_log.go fix goroutine leaks in events and logs backend 2022-07-26 13:54:28 -04:00
container_log_linux.go fix goroutine leaks in events and logs backend 2022-07-26 13:54:28 -04:00
container_log_unsupported.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
container_path_resolution.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
container_stat_linux.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
container_top_linux.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
container_validate.go health check: add on-failure actions 2022-09-27 10:40:36 +02:00
diff.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
doc.go document that using libpod package directly is not supported 2022-03-23 19:05:29 +01:00
events.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
healthcheck.go health checks: make on-failure action retry aware 2022-10-07 13:47:06 -04:00
healthcheck_linux.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
info.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
info_linux.go Adjust for common bump 2026-01-28 10:48:05 -05:00
info_test.go Robust whitespace split of cpu utilization line from /proc/stat 2022-05-14 00:34:56 +00:00
kube.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
mounts_linux.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
networking_common.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
networking_linux.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
networking_linux_test.go enable unparam linter 2022-04-25 13:23:20 +02:00
networking_machine.go enable gocritic linter 2022-04-26 18:12:22 +02:00
networking_slirp4netns.go Adjust for common bump 2026-01-28 10:48:05 -05:00
oci.go use c/common code for resize and CopyDetachable 2022-07-06 16:57:07 +02:00
oci_conmon.go podman: add new cgroup mode split 2020-06-25 17:16:12 +02:00
oci_conmon_attach_common.go Adjust for common bump 2026-01-28 10:48:05 -05:00
oci_conmon_attach_linux.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
oci_conmon_common.go Adjust for common bump 2026-01-28 10:48:05 -05:00
oci_conmon_exec_common.go Fix capability copying 2026-03-30 15:13:31 -04:00
oci_conmon_exec_linux.go Fix capability copying 2026-03-30 15:13:31 -04:00
oci_conmon_linux.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
oci_missing.go use c/common code for resize and CopyDetachable 2022-07-06 16:57:07 +02:00
oci_util.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
options.go Adjust for common bump 2026-01-28 10:48:05 -05:00
pod.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
pod_api.go Merge pull request #14501 from cdoern/podUTS 2022-07-06 14:51:22 +00:00
pod_internal.go [v4.2.0-rhel] all: stop using deprecated GenerateNonCryptoID 2023-02-01 16:35:50 -05:00
pod_status.go bump go module to version 4 2022-01-18 12:47:07 +01:00
pod_top_linux.go libpod/pod_top_linux.go: s/TODO/NOTE/ 2022-05-25 12:30:19 +02:00
reset.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
runtime.go Fix runtime initialization for missing StaticDir and VolumePath 2026-03-30 15:13:31 -04:00
runtime_cstorage.go libpod/runtime: switch to golang native error wrapping 2022-07-04 15:39:00 +02:00
runtime_ctr.go [v4.2.0-rhel] all: stop using deprecated GenerateNonCryptoID 2023-02-01 16:35:50 -05:00
runtime_img.go libpod/runtime: switch to golang native error wrapping 2022-07-04 15:39:00 +02:00
runtime_migrate.go libpod/runtime: switch to golang native error wrapping 2022-07-04 15:39:00 +02:00
runtime_pod.go libpod/runtime: switch to golang native error wrapping 2022-07-04 15:39:00 +02:00
runtime_pod_linux.go libpod: do not lock all containers on pod rm 2022-07-26 14:42:19 -04:00
runtime_renumber.go libpod/runtime: switch to golang native error wrapping 2022-07-04 15:39:00 +02:00
runtime_volume.go libpod/runtime: switch to golang native error wrapping 2022-07-04 15:39:00 +02:00
runtime_volume_linux.go [v4.2.0-rhel] all: stop using deprecated GenerateNonCryptoID 2023-02-01 16:35:50 -05:00
runtime_worker.go work queue: simplify and use a wait group 2022-05-25 10:17:46 +02:00
service.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
state.go Fix compilation errors for v4.4.1-rhel compatibility 2026-03-30 14:52:52 -04:00
state_test.go bump go module to version 4 2022-01-18 12:47:07 +01:00
stats.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
storage.go Fix userns=auto failures in rootless mode 2026-03-30 15:13:31 -04:00
util.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
util_linux.go Adjust for common bump 2026-01-28 10:48:05 -05:00
util_linux_test.go replace deprecated selinux/label calls 2026-01-28 10:48:05 -05:00
util_test.go bump go module to version 4 2022-01-18 12:47:07 +01:00
volume.go Add support for containers.conf volume timeouts 2022-10-06 15:07:10 -04:00
volume_inspect.go Add support for containers.conf volume timeouts 2022-10-06 15:07:10 -04:00
volume_internal.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00
volume_internal_linux.go libpod: switch to golang native error wrapping 2022-07-05 16:06:32 +02:00