Skip to content

"operation not permitted", a libseccomp story #16829

Open
@yosifkit

Description

@yosifkit

This issue is to show example errors that happen when dockerd1 and/or libseccomp[2]2 are not up-to-date when using images based on a newer Linux distribution release.


TL;DR:
libseccomp lets you configure allowed syscalls for a process. Docker sets a default seccomp profile for all containers such that only certain syscalls are allowed and everything else is blocked (so, newer syscalls that are not yet known to libseccomp or docker are blocked3).

  • verify that it is libseccomp by running the image with --security-opt seccomp=unconfined
  • one fix:
    • update libseccomp and docker on the host running the containers
  • one workaround:
    • switch to an older image:

      Many Docker Official Images have tags that reference the Linux distribution and some DOI support two concurrently. Check their Docker Hub description to see which tags are currently maintained.

      for example, if 16 started failing when it moved to Debian Bookworm, then 16-bullseye is a valid workaround until the host can be updated. And similar for 16-alpine and 16-alpine3.19.
      image


One example is that, on some platforms, tar -xzf file.tar.gz uses fchmodat2 in Alpine 3.20 and fails. This syscall isn't in Docker's seccomp profile until Docker 26.0.0, 25.0.3, 24.0.10, and 23.0.10 (see moby/moby#47341 and linked backports).

example:

+ wget -O memcached.tar.gz [https://memcached.org/files/memcached-1.6.27.tar.gz](https://memcached.org/files/memcached-1.6.27.tar.gz)
Connecting to memcached.org (107.170.231.145:443)
saving to 'memcached.tar.gz'
memcached.tar.gz     100% |********************************| 1161k  0:00:00 ETA
'memcached.tar.gz' saved
+ echo 'baf2e7494e1f62d275ff29a99f270abbdb923f75  memcached.tar.gz'
+ sha1sum -c -
memcached.tar.gz: OK
+ mkdir -p /usr/src/memcached
+ tar -xzf memcached.tar.gz -C /usr/src/memcached '--strip-components=1'
tar: t/sasl: Cannot change mode to rwxrwxr-x: Operation not permitted
tar: t/lib: Cannot change mode to rwxr-xr-x: Operation not permitted
tar: t: Cannot change mode to rwxr-xr-x: Operation not permitted
tar: m4: Cannot change mode to rwxrwxr-x: Operation not permitted
tar: doc/xml2rfc: Cannot change mode to rwxrwxr-x: Operation not permitted
tar: doc: Cannot change mode to rwxr-xr-x: Operation not permitted
...

other issues that are also a libseccomp denial:

related moby (docker) issues:


1 runc and containerd should be up-to-date as well but are usually included as a dependency when updating Docker (engine)

2 might even require a newer libseccomp[2] package than your distribution/release currently includes, such as needing 2.5.5+ for fchmodat2 (#16830 (comment), https://bugs.debian.org/1071822)

3 newer versions of docker and dependencies are being improved to block known syscalls (EPERM), but newer syscalls should get ENOSYS: moby/moby#42871

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions