-
Notifications
You must be signed in to change notification settings - Fork 2.2k
seccomp: skip redundant rules #3109
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
Conversation
52ab214 to
eaaf614
Compare
|
@opencontainers/runc-maintainers PTAL; this is a P0 as runc is rendered totally useless. |
cyphar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the warning for unknown syscalls to a debug message. As for the rest of the patch, LGTM (though this seems like it's a bug in podman not in runc, but since the old behaviour is kind brittle and is not defined in the spec, I'm okay with working around it anyway).
Yes, it is (and it is being fixed). But there were also older bug reports with the same diagnostics (not sure how they
I think it is defined in spec (see the last paragraph in #1847 description ... and yes, we need a CI job to run those tools, I'll get around to it later). |
As of commit caca840 (Nov 12 2015) SCMP_ACT_TRACE is supported. Signed-off-by: Kir Kolyshkin <[email protected]>
Rather than silently ignoring unknown syscalls, print a warning. While at it, fix imports ordering (stdlib, others, ours). [v2: demote Warn to Debug] 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]>
cyphar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
Probably needs a changelog entry too. |
Added |
This fixes using runc with podman on my system (Fedora 34).
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:
(Note that defaultErrnoRet is not set, but it defaults to 1).
With this commit, it works:
Similar crun commit:
Fixes: #1847
See also: containers/podman#11031
Changelog entry
1.0 backport: #3129