aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index cc69ff1c7..1d611ffba 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -49,7 +49,9 @@
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/syscall.h>
+#if HAVE_SECCOMP
#include <seccomp.h>
+#endif
#define pivot_root(new_root, put_old) (syscall(SYS_pivot_root, new_root, put_old))
#endif
@@ -2471,7 +2473,7 @@ void setupSeccomp()
{
#if __linux__
if (!settings.filterSyscalls) return;
-
+#if HAVE_SECCOMP
scmp_filter_ctx ctx;
if (!(ctx = seccomp_init(SCMP_ACT_ALLOW)))
@@ -2517,6 +2519,11 @@ void setupSeccomp()
if (seccomp_load(ctx) != 0)
throw SysError("unable to load seccomp BPF program");
+#else
+ throw Error(
+ "seccomp is not supported on this platform; "
+ "you can bypass this error by setting the option 'filter-syscalls' to false, but note that untrusted builds can then create setuid binaries!");
+#endif
#endif
}