Skip to content

Commit

Permalink
seccomp: do not fail on error from seccomp_arch_add()
Browse files Browse the repository at this point in the history
Especially ignore EDOM on ppc64le

Fix containers/podman#6922

Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Jul 13, 2020
1 parent 23ce219 commit be91429
Showing 1 changed file with 9 additions and 6 deletions.
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

0 comments on commit be91429

Please sign in to comment.