summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hromatka <tom.hromatka@oracle.com>2020-02-03 11:37:28 -0700
committerGitHub <noreply@github.com>2020-02-03 11:37:28 -0700
commitc09346bb9847c2a1506bb5ed55afcf78d199bea6 (patch)
treea2da21f8c26efd1e46cb6e25e7ba0957fbe29c95
parentc4901128e67458b6448ae310e5b9949697c3608e (diff)
parentb86a66276b840618def67b747c64a72245cd57a4 (diff)
downloadlibseccomp-c09346bb9847c2a1506bb5ed55afcf78d199bea6.tar.gz
Merge pull request #205 from drakenclimber/backports/v2.4.3
Backports for v2.4.3
-rw-r--r--.travis.yml4
-rw-r--r--include/seccomp-syscalls.h7
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/15-basic-resolver.c6
-rw-r--r--tests/52-basic-load.c48
-rwxr-xr-xtests/52-basic-load.py38
-rw-r--r--tests/52-basic-load.tests11
-rw-r--r--tests/Makefile.am9
-rw-r--r--tools/Makefile.am3
-rw-r--r--tools/scmp_bpf_sim.c2
10 files changed, 118 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml
index 64252aa..63aa56b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,9 @@
# Travis CI configuration for libseccomp
-# https://docs.travis-ci.com/user/trusty-ci-environment
+# https://docs.travis-ci.com/user/reference/bionic
# https://wiki.ubuntu.com/Releases
-dist: xenial
+dist: bionic
sudo: false
notifications:
diff --git a/include/seccomp-syscalls.h b/include/seccomp-syscalls.h
index 6457592..3c958df 100644
--- a/include/seccomp-syscalls.h
+++ b/include/seccomp-syscalls.h
@@ -272,6 +272,7 @@
#define __PNR_timerfd_gettime64 -10238
#define __PNR_timerfd_settime64 -10239
#define __PNR_utimensat_time64 -10240
+#define __PNR_ppoll -10241
/*
* libseccomp syscall definitions
@@ -1359,6 +1360,12 @@
#define __SNR_poll __PNR_poll
#endif
+#ifdef __NR_ppoll
+#define __SNR_ppoll __NR_ppoll
+#else
+#define __SNR_ppoll __PNR_ppoll
+#endif
+
#ifdef __NR_ppoll_time64
#define __SNR_ppoll_time64 __NR_ppoll_time64
#else
diff --git a/tests/.gitignore b/tests/.gitignore
index a5bc9e4..17297a2 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -56,3 +56,4 @@ util.pyc
48-sim-32b_args
49-sim-64b_comparisons
50-sim-hash_collision
+52-basic-load
diff --git a/tests/15-basic-resolver.c b/tests/15-basic-resolver.c
index 6badef1..0c1eefe 100644
--- a/tests/15-basic-resolver.c
+++ b/tests/15-basic-resolver.c
@@ -55,15 +55,15 @@ int main(int argc, char *argv[])
unsigned int arch;
char *name = NULL;
- if (seccomp_syscall_resolve_name("open") != __NR_open)
+ if (seccomp_syscall_resolve_name("open") != __SNR_open)
goto fail;
- if (seccomp_syscall_resolve_name("read") != __NR_read)
+ if (seccomp_syscall_resolve_name("read") != __SNR_read)
goto fail;
if (seccomp_syscall_resolve_name("INVALID") != __NR_SCMP_ERROR)
goto fail;
rc = seccomp_syscall_resolve_name_rewrite(SCMP_ARCH_NATIVE, "openat");
- if (rc != __NR_openat)
+ if (rc != __SNR_openat)
goto fail;
while ((arch = arch_list[iter++]) != -1) {
diff --git a/tests/52-basic-load.c b/tests/52-basic-load.c
new file mode 100644
index 0000000..2f2b516
--- /dev/null
+++ b/tests/52-basic-load.c
@@ -0,0 +1,48 @@
+/**
+ * Seccomp Library test program
+ *
+ * Copyright (c) 2019 Cisco Systems, Inc. <pmoore2@cisco.com>
+ * Author: Paul Moore <paul@paul-moore.com>
+ */
+
+/*
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of version 2.1 of the GNU Lesser General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses>.
+ */
+
+#include <errno.h>
+#include <unistd.h>
+
+#include <seccomp.h>
+
+#include "util.h"
+
+int main(int argc, char *argv[])
+{
+ int rc;
+ struct util_options opts;
+ scmp_filter_ctx ctx = NULL;
+
+ rc = util_getopt(argc, argv, &opts);
+ if (rc < 0)
+ goto out;
+
+ ctx = seccomp_init(SCMP_ACT_ALLOW);
+ if (ctx == NULL)
+ return ENOMEM;
+
+ rc = seccomp_load(ctx);
+
+out:
+ seccomp_release(ctx);
+ return (rc < 0 ? -rc : rc);
+}
diff --git a/tests/52-basic-load.py b/tests/52-basic-load.py
new file mode 100755
index 0000000..4395a79
--- /dev/null
+++ b/tests/52-basic-load.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+#
+# Seccomp Library test program
+#
+# Copyright (c) 2019 Cisco Systems, Inc. <pmoore2@cisco.com>
+# Author: Paul Moore <paul@paul-moore.com>
+#
+
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of version 2.1 of the GNU Lesser General Public License as
+# published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+# for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, see <http://www.gnu.org/licenses>.
+#
+
+import argparse
+import sys
+
+import util
+
+from seccomp import *
+
+def test():
+ f = SyscallFilter(ALLOW)
+ f.load()
+
+test()
+
+# kate: syntax python;
+# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;
diff --git a/tests/52-basic-load.tests b/tests/52-basic-load.tests
new file mode 100644
index 0000000..510e2d3
--- /dev/null
+++ b/tests/52-basic-load.tests
@@ -0,0 +1,11 @@
+#
+# libseccomp regression test automation data
+#
+# Copyright (c) 2013 Red Hat <pmoore@redhat.com>
+# Author: Paul Moore <paul@paul-moore.com>
+#
+
+test type: basic
+
+# Test command
+52-basic-load
diff --git a/tests/Makefile.am b/tests/Makefile.am
index eb84e14..f667b7d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -89,7 +89,8 @@ check_PROGRAMS = \
47-live-kill_process \
48-sim-32b_args \
49-sim-64b_comparisons \
- 50-sim-hash_collision
+ 50-sim-hash_collision \
+ 52-basic-load
EXTRA_DIST_TESTPYTHON = \
util.py \
@@ -141,7 +142,8 @@ EXTRA_DIST_TESTPYTHON = \
47-live-kill_process.py \
48-sim-32b_args.py \
49-sim-64b_comparisons.py \
- 50-sim-hash_collision.py
+ 50-sim-hash_collision.py \
+ 52-basic-load.py
EXTRA_DIST_TESTCFGS = \
01-sim-allow.tests \
@@ -193,7 +195,8 @@ EXTRA_DIST_TESTCFGS = \
47-live-kill_process.tests \
48-sim-32b_args.tests \
49-sim-64b_comparisons.tests \
- 50-sim-hash_collision.tests
+ 50-sim-hash_collision.tests \
+ 52-basic-load.tests
EXTRA_DIST_TESTSCRIPTS = \
38-basic-pfc_coverage.sh 38-basic-pfc_coverage.pfc
diff --git a/tools/Makefile.am b/tools/Makefile.am
index f35b0a5..92543a1 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -35,10 +35,7 @@ scmp_bpf_sim_SOURCES = scmp_bpf_sim.c bpf.h util.h
scmp_api_level_SOURCES = scmp_api_level.c
scmp_sys_resolver_LDADD = ../src/libseccomp.la
-scmp_sys_resolver_LDFLAGS = -static
scmp_arch_detect_LDADD = ../src/libseccomp.la
-scmp_arch_detect_LDFLAGS = -static
scmp_bpf_disasm_LDADD = util.la
scmp_bpf_sim_LDADD = util.la
scmp_api_level_LDADD = ../src/libseccomp.la
-scmp_api_level_LDFLAGS = -static
diff --git a/tools/scmp_bpf_sim.c b/tools/scmp_bpf_sim.c
index 1408717..4d30822 100644
--- a/tools/scmp_bpf_sim.c
+++ b/tools/scmp_bpf_sim.c
@@ -289,6 +289,8 @@ int main(int argc, char *argv[])
exit_fault(EINVAL);
break;
case 'f':
+ if (opt_file)
+ exit_fault(EINVAL);
opt_file = strdup(optarg);
if (opt_file == NULL)
exit_fault(ENOMEM);