summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/seccomp-util.c10
-rw-r--r--src/shared/seccomp-util.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c
index b549426e2b..6c489284d1 100644
--- a/src/shared/seccomp-util.c
+++ b/src/shared/seccomp-util.c
@@ -21,6 +21,8 @@
#include <seccomp.h>
#include <stddef.h>
+#include "alloc-util.h"
+#include "fileio.h"
#include "macro.h"
#include "seccomp-util.h"
#include "string-util.h"
@@ -89,6 +91,14 @@ int seccomp_add_secondary_archs(scmp_filter_ctx *c) {
}
+bool is_seccomp_available(void) {
+ _cleanup_free_ char* field = NULL;
+ static int cached_enabled = -1;
+ if (cached_enabled < 0)
+ cached_enabled = get_proc_field("/proc/self/status", "Seccomp", "\n", &field) == 0;
+ return cached_enabled;
+}
+
const SystemCallFilterSet syscall_filter_sets[] = {
{
/* Clock */
diff --git a/src/shared/seccomp-util.h b/src/shared/seccomp-util.h
index be33eecb85..cca7c17912 100644
--- a/src/shared/seccomp-util.h
+++ b/src/shared/seccomp-util.h
@@ -27,6 +27,8 @@ int seccomp_arch_from_string(const char *n, uint32_t *ret);
int seccomp_add_secondary_archs(scmp_filter_ctx *c);
+bool is_seccomp_available(void);
+
typedef struct SystemCallFilterSet {
const char *set_name;
const char *value;