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: do not fail on error from seccomp_arch_add() #219

Merged
merged 1 commit into from
Jul 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions seccompfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <seccomp.h>
#include "seccomparch.h"

Expand All @@ -16,9 +17,10 @@ int enable_seccomp()
for (i = 0; i < seccomp_extra_archs_items; i++) {
uint32_t arch = seccomp_extra_archs[i];
rc = seccomp_arch_add(ctx, arch);
if (rc < 0 && rc != -EEXIST) {
fprintf(stderr, "seccomp: can't add extra arch (i=%d)\n", i);
goto ret;
if (rc < 0 && rc != -EEXIST && rc != -EDOM) {
fprintf(stderr,
"seccomp: WARNING: can't add extra arch (i=%d): %s\n", i,
strerror(-rc));
}
}
printf("seccomp: The following syscalls will be blocked by seccomp:");
Expand All @@ -38,9 +40,10 @@ int enable_seccomp()
#ifdef __NR_execveat
BLOCK(execveat);
#else
fprintf(stderr,
"seccomp: can't block execevat because __NR_execveat was not "
"defined in the build environment\n");
fprintf(
stderr,
"seccomp: WARNING: can't block execveat because __NR_execveat was not "
"defined in the build environment\n");
#endif
/* ideally we should also block open() and openat() but required for
* resolv.conf */
Expand Down