Skip to content

seccomp: always include runtime arch in resulting profile#27

Open
takumi12311123 wants to merge 1 commit into
moby:mainfrom
takumi12311123:seccomp-native-arch
Open

seccomp: always include runtime arch in resulting profile#27
takumi12311123 wants to merge 1 commit into
moby:mainfrom
takumi12311123:seccomp-native-arch

Conversation

@takumi12311123
Copy link
Copy Markdown

Profiles whose architectures list omits the runtime architecture (and default profiles on architectures not listed in arches() — most notably the PPC family) cause syscalls unknown to libseccomp to return -EPERM instead of the -ENOSYS stub libcontainer expects. glibc relies on -ENOSYS to fall back to older syscalls; without it, simple operations like chmod -R fail on ppc64le containers (e.g. fchmodat2 -> EPERM on Debian sid; reported in moby/moby#48471 by @grooverdan via dh_installdocs on a MariaDB build).

Mirrors the analogous runc fix in opencontainers/runc#4219:

  • seccomp/default_linux.go: add the PPC family (PPC64LE, PPC64, PPC) to the architectures bundled into the default profile.
  • seccomp/seccomp_linux.go: append the runtime arch to the resolved profile when it is not already present, so user-supplied profiles which set "architectures" explicitly still get the ENOSYS stub for the host.
  • seccomp/default.json: regenerated via go generate ./seccomp/.

Tests cover: an empty "architectures" list, a foreign-arch list, an already-present runtime arch (de-dup), and an archMap that supplied the runtime arch (de-dup via slices.Contains). A host-agnostic test asserts the PPC entries in arches() so amd64 CI catches regressions too.

Locally verified via docker run --platform=linux/{amd64,arm64,ppc64le,s390x} golang:1.23 go test ./seccomp/... — all pass.


Created with: Claude Code (Opus 4.7)

Profiles whose `architectures` list omits the runtime architecture (and
default profiles on architectures not listed in arches()) cause syscalls
unknown to libseccomp to return -EPERM instead of the -ENOSYS stub that
libcontainer expects. glibc relies on -ENOSYS to fall back to older
syscalls; without it, simple operations like `chmod -R` fail on ppc64le
containers (e.g. fchmodat2 -> EPERM on Debian sid; moby/moby#48471).

Mirror opencontainers/runc#4219:

  - default_linux.go: add the PPC family (PPC64LE, PPC64, PPC) to the
    architectures bundled into the default profile.
  - seccomp_linux.go: append the runtime arch to the resolved profile
    when it is not already present, so custom profiles which set
    "architectures" explicitly still get the ENOSYS stub for the host.
  - default.json: regenerated.

Tests cover: an empty "architectures" list, a foreign-arch list, an
already-present runtime arch (de-dup), and an archMap that supplied the
runtime arch (de-dup via slices.Contains). A host-agnostic test asserts
PPC entries in arches() so amd64 CI catches regressions too.

Signed-off-by: Takumi Akasaka <takumiakasaka1231@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant