Test SCMP_ACT_LOG as the default action which all syscalls trigger.
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
37-sim-ipc_syscalls_be
38-basic-pfc_coverage
39-basic-api_level
+40-sim-log
--- /dev/null
+/**
+ * Seccomp Library test program
+ *
+ * Originally 01-sim-allow.c but updated to use SCMP_ACT_LOG.
+ *
+ * Copyright (c) 2012 Red Hat <pmoore@redhat.com>
+ * Author: Paul Moore <paul@paul-moore.com>
+ *
+ * Copyright (c) 2017 Canonical Ltd.
+ * Author: Tyler Hicks <tyhicks@canonical.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;
+
+ rc = seccomp_api_set(3);
+ if (rc != 0)
+ return EOPNOTSUPP;
+
+ ctx = seccomp_init(SCMP_ACT_LOG);
+ if (ctx == NULL)
+ return ENOMEM;
+
+ rc = util_filter_output(&opts, ctx);
+ if (rc)
+ goto out;
+
+out:
+ seccomp_release(ctx);
+ return (rc < 0 ? -rc : rc);
+}
--- /dev/null
+#!/usr/bin/env python
+
+#
+# Seccomp Library test program
+#
+# Originally 01-sim-allow.py but updated to use LOG.
+#
+# Copyright (c) 2012 Red Hat <pmoore@redhat.com>
+# Author: Paul Moore <paul@paul-moore.com>
+#
+# Copyright (c) 2017 Canonical Ltd.
+# Author: Tyler Hicks <tyhicks@canonical.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(args):
+ set_api(3)
+
+ f = SyscallFilter(LOG)
+ return f
+
+args = util.get_opt()
+ctx = test(args)
+util.filter_output(args, ctx)
+
+# kate: syntax python;
+# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;
--- /dev/null
+#
+# libseccomp regression test automation data
+#
+# Copyright Canonical Ltd. 2017
+# Author: Tyler Hicks <tyhicks@canonical.com>
+#
+
+test type: bpf-sim
+
+# Testname Arch Syscall Arg0 Arg1 Arg2 Arg3 Arg4 Arg5 Result
+40-sim-log all 0-350 N N N N N N LOG
+
+test type: bpf-sim-fuzz
+
+# Testname StressCount
+40-sim-log 50
+
+test type: bpf-valgrind
+
+# Testname
+40-sim-log
36-sim-ipc_syscalls \
37-sim-ipc_syscalls_be \
38-basic-pfc_coverage \
- 39-basic-api_level
+ 39-basic-api_level \
+ 40-sim-log
EXTRA_DIST_TESTPYTHON = \
util.py \
34-sim-basic_blacklist.py \
35-sim-negative_one.py \
36-sim-ipc_syscalls.py \
- 37-sim-ipc_syscalls_be.py
+ 37-sim-ipc_syscalls_be.py \
+ 40-sim-log.py
EXTRA_DIST_TESTCFGS = \
01-sim-allow.tests \
36-sim-ipc_syscalls.tests \
37-sim-ipc_syscalls_be.tests \
38-basic-pfc_coverage.tests \
- 39-basic-api_level.tests
+ 39-basic-api_level.tests \
+ 40-sim-log.tests
EXTRA_DIST_TESTSCRIPTS = \
38-basic-pfc_coverage.sh 38-basic-pfc_coverage.pfc