Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"operation not permitted", a libseccomp story #16829

Open
yosifkit opened this issue May 23, 2024 · 1 comment
Open

"operation not permitted", a libseccomp story #16829

yosifkit opened this issue May 23, 2024 · 1 comment

Comments

@yosifkit
Copy link
Member

yosifkit commented May 23, 2024

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) issue:


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

@tianon tianon pinned this issue May 24, 2024
@tianon
Copy link
Member

tianon commented May 24, 2024

To be explicitly clear: this is intended as an informational / reference issue, not a place to discuss more/related issues or as a place to ask for help. Any comments doing so will be hidden (and if it is a recurring problem, we will have to lock the issue, but we'd like to avoid doing that because it stops back-references from showing up here appropriately and those are useful).

As a friendly reminder, if you need help (or are unsure whether this is "the issue" you're seeing), try a dedicated support forum such as the Docker Community Slack, Server Fault, Unix & Linux, or Stack Overflow.

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

No branches or pull requests

2 participants