Skip to content

Commit 690ac7c

Browse files
committedFeb 18, 2018
configure: Add a flag to disable seccomp.
This is needed for new arches where libseccomp support doesn't exist yet. Fixes #1878.
1 parent 3a5a241 commit 690ac7c

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed
 

‎Makefile.config.in

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ENABLE_S3 = @ENABLE_S3@
77
HAVE_SODIUM = @HAVE_SODIUM@
88
HAVE_READLINE = @HAVE_READLINE@
99
HAVE_BROTLI = @HAVE_BROTLI@
10+
HAVE_SECCOMP = @HAVE_SECCOMP@
1011
LIBCURL_LIBS = @LIBCURL_LIBS@
1112
OPENSSL_LIBS = @OPENSSL_LIBS@
1213
PACKAGE_NAME = @PACKAGE_NAME@

‎configure.ac

+14-2
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,21 @@ AC_SUBST(HAVE_BROTLI, [$have_brotli])
186186

187187
# Look for libseccomp, required for Linux sandboxing.
188188
if test "$sys_name" = linux; then
189-
PKG_CHECK_MODULES([LIBSECCOMP], [libseccomp],
190-
[CXXFLAGS="$LIBSECCOMP_CFLAGS $CXXFLAGS"])
189+
AC_ARG_ENABLE([seccomp-sandboxing],
190+
AC_HELP_STRING([--disable-seccomp-sandboxing],
191+
[Don't build support for seccomp sandboxing (only recommended if your arch doesn't support libseccomp yet!)]
192+
))
193+
if test "x$enable_seccomp_sandboxing" != "xno"; then
194+
PKG_CHECK_MODULES([LIBSECCOMP], [libseccomp],
195+
[CXXFLAGS="$LIBSECCOMP_CFLAGS $CXXFLAGS"])
196+
have_seccomp=1
197+
else
198+
have_seccomp=
199+
fi
200+
else
201+
have_seccomp=
191202
fi
203+
AC_SUBST(HAVE_SECCOMP, [$have_seccomp])
192204

193205

194206
# Look for aws-cpp-sdk-s3.

‎src/libstore/build.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
#include <sys/param.h>
5050
#include <sys/mount.h>
5151
#include <sys/syscall.h>
52+
#if HAVE_SECCOMP
5253
#include <seccomp.h>
54+
#endif
5355
#define pivot_root(new_root, put_old) (syscall(SYS_pivot_root, new_root, put_old))
5456
#endif
5557

@@ -2469,7 +2471,7 @@ void DerivationGoal::chownToBuilder(const Path & path)
24692471

24702472
void setupSeccomp()
24712473
{
2472-
#if __linux__
2474+
#if __linux__ && HAVE_SECCOMP
24732475
if (!settings.filterSyscalls) return;
24742476

24752477
scmp_filter_ctx ctx;

‎src/libstore/local.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ifeq ($(OS), SunOS)
2525
libstore_LDFLAGS += -lsocket
2626
endif
2727

28-
ifeq ($(OS), Linux)
28+
ifeq ($(HAVE_SECCOMP), 1)
2929
libstore_LDFLAGS += -lseccomp
3030
endif
3131

0 commit comments

Comments
 (0)