Skip to content

Commit 51f5c97

Browse files
NO-JIRA: docs: add source code analysis of podman namespace behavior
Trace MaybeReexecUsingUserNamespace (skips with CAP_SYS_ADMIN), buildah setupNamespaces (--network=host skips net ns), and chroot isolation path. Document that the DNS failure on s390x remains unexplained at the source code level — rootful podman with CAP_SYS_ADMIN should not create user namespaces, yet DNS still fails. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d00f9b4 commit 51f5c97

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

docs/ibmactionspz.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,40 @@ environment. The `--network=host` flag is insufficient to fix this.
243243
(`podman load`, `podman build --pull=never` with offline `RUN` steps).
244244
Any operation requiring network access must use Docker.
245245

246+
### Source code analysis: why does rootful podman break DNS?
247+
248+
Investigated the `containers/storage` and `buildah` source code to
249+
understand the namespace creation path:
250+
251+
**`MaybeReexecUsingUserNamespace(false)`** (containers/storage):
252+
Called from `buildah/cmd/buildah/main.go` `before()`. With `evenForRoot=false`
253+
and `CAP_SYS_ADMIN` present (which we have in `docker --privileged`),
254+
it **returns immediately without re-execing**. So `containers/storage`
255+
is NOT creating user namespaces in our scenario.
256+
257+
**`setupNamespaces()`** (buildah `run_linux.go`):
258+
For `RUN` steps, this function decides whether to create user+network
259+
namespaces. With `--network=host`, `specifiedNetwork=true` and the
260+
automatic network namespace creation is skipped. With `--isolation=chroot`,
261+
the OCI runtime is bypassed entirely.
262+
263+
**The mystery:** Despite `MaybeReexecUsingUserNamespace` skipping,
264+
`--network=host` being set, and `--isolation=chroot` being used,
265+
podman still fails DNS on s390x. The failure occurs both during
266+
`podman pull` (which shouldn't use namespaces at all when rootful with
267+
`CAP_SYS_ADMIN`) and during `podman build` `RUN` steps (even with chroot
268+
isolation). Since `unshare --user` + socket works in the same environment,
269+
the issue is specific to podman's process setup, not a general namespace
270+
restriction.
271+
272+
**Open question:** What does podman do between process start and the DNS
273+
query that triggers the AppArmor/LXD restriction? Candidates:
274+
- Podman's C constructor in `rootless_linux.c` (`reexec_in_user_namespace`)
275+
- The `containers/storage` overlay mount setup creating mount namespaces
276+
- The Go runtime's thread creation interacting with LXD's cgroup/namespace
277+
restrictions
278+
- A Fedora 44 / podman 5.8.2 regression on s390x
279+
246280
Docker works because `dockerd` runs as a system service in the primary
247281
namespace and handles all network I/O there. Client commands talk to
248282
dockerd via a Unix socket.

0 commit comments

Comments
 (0)