Skip to content

Conversation

@kolyshkin
Copy link
Contributor

Backport of #3109 (partial -- last commit only) to release-1.0 branch. Original description follows.


This fixes using runc with podman on my system (Fedora 34).

$ podman --runtime pwd/runc run --rm --memory 4M fedora echo it works
Error: unable to start container process: error adding seccomp filter rule for syscall bdflush: permission denied: OCI permission denied

The problem is, libseccomp returns EPERM when a redundant rule (i.e. the
rule with the same action as the default one) is added, and podman (on
my machine) sets the following rules in config.json:

<....>
"seccomp": {
  "defaultAction": "SCMP_ACT_ERRNO",
  "architectures": [
    "SCMP_ARCH_X86_64",
    "SCMP_ARCH_X86",
    "SCMP_ARCH_X32"
  ],
  "syscalls": [
    {
      "names": [
        "bdflush",
        "io_pgetevents",
        <....>
      ],
      "action": "SCMP_ACT_ERRNO",
      "errnoRet": 1
    },
    <....>

(Note that defaultErrnoRet is not set, but it defaults to 1).

With this commit, it works:

$ podman --runtime pwd/runc run --memory 4M fedora echo it works
it works

Add an integration test (that fails without the fix).

Similar crun commit:

Signed-off-by: Kir Kolyshkin [email protected]

Cherry picked from commit 5dd92fd.
Minor conflict in libcontainer/seccomp/seccomp_linux.go due to
missing commit e44bee1.

Signed-off-by: Kir Kolyshkin [email protected]

This fixes using runc with podman on my system (Fedora 34).

> $ podman --runtime `pwd`/runc run --rm --memory 4M fedora echo it works
> Error: unable to start container process: error adding seccomp filter rule for syscall bdflush: permission denied: OCI permission denied

The problem is, libseccomp returns EPERM when a redundant rule (i.e. the
rule with the same action as the default one) is added, and podman (on
my machine) sets the following rules in config.json:

    <....>
    "seccomp": {
      "defaultAction": "SCMP_ACT_ERRNO",
      "architectures": [
        "SCMP_ARCH_X86_64",
        "SCMP_ARCH_X86",
        "SCMP_ARCH_X32"
      ],
      "syscalls": [
        {
          "names": [
            "bdflush",
            "io_pgetevents",
            <....>
          ],
          "action": "SCMP_ACT_ERRNO",
          "errnoRet": 1
        },
        <....>

(Note that defaultErrnoRet is not set, but it defaults to 1).

With this commit, it works:

> $ podman --runtime `pwd`/runc run --memory 4M fedora echo it works
> it works

Add an integration test (that fails without the fix).

Similar crun commit:
 * containers/crun@08229f3fb904c5ea19a7d9

Signed-off-by: Kir Kolyshkin <[email protected]>

Cherry picked from commit 5dd92fd.
Minor conflict in libcontainer/seccomp/seccomp_linux.go due to
missing commit e44bee1.

Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin kolyshkin added area/seccomp kind/bug backport/1.0-pr A backport PR to release-1.0 labels Aug 4, 2021
@kolyshkin kolyshkin added this to the 1.0.2 milestone Aug 4, 2021
@kolyshkin
Copy link
Contributor Author

I'm sure Fedora users will appreciate it.

@kolyshkin kolyshkin requested a review from cyphar August 4, 2021 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants