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

seccomp: move generation out of cgroup and do not fail on unknown syscalls #211

Merged
merged 2 commits into from
Dec 20, 2019

Conversation

giuseppe
Copy link
Member

two separate changes I've put together on the same PR to avoid rebasing:

  • The first one is to move seccomp generation out of the init process. It improves memory usage for the init process and now containers (assuming the init process doesn't need more) can run with 250K memory max configured in the cgroup.

  • The second one is to not fail on unknown syscalls specified to seccomp. An annotation is added too keep the previous behaviour.

More details are in the commit messages.

Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com

@rhatdan
Copy link
Member

rhatdan commented Dec 17, 2019

Needs rebase.

generate the seccomp profile in the parent process, not from init
while running with cgroups configured.

The reason is that seccomp generation might require more memory than
it is configured in the cgroups.

crun memory consumption is more predictable now, and can run with less
than 500Kb of memory in the cgroup (I've tested that it runs reliably
with 250Kb and never hit any OOM).

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
when a syscall that is not known to libseccomp is specified, ignore it
instead of failing.

It makes easier to use newer seccomp policies on systems using an
older libseccomp.

It is possible to keep the previous behavior using the
"run.oci.seccomp_fail_unknown_syscall=1" annotation.

Closes: containers#156

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe giuseppe force-pushed the move-seccomp-gen-out-of-cgroup branch from 5618453 to 4bf2698 Compare December 17, 2019 15:43
@rhatdan
Copy link
Member

rhatdan commented Dec 17, 2019

@giuseppe Could you fix the issue that @haircommander pointed out in this PR.
I think we also have an issue with
crun kill --all
That would be good to fix before you cut a new version.

int libcrun_generate_and_load_seccomp (libcrun_container_t *container, int outfd, char **flags, size_t flags_len, libcrun_error_t *err);
enum
{
LIBCRUN_SECCOMP_FAIL_UNKNOWN_SYSCALL = 1 << 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why shift by 0? or am I misreading here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no misreading, it is really a shift by 0 :-) It is a nop but it makes clear it is a bitmask

@rhatdan
Copy link
Member

rhatdan commented Dec 20, 2019

LGTM

@rhatdan rhatdan merged commit 5b6a912 into containers:master Dec 20, 2019
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.

3 participants