]> git.proxmox.com Git - mirror_libseccomp.git/log
mirror_libseccomp.git
5 years agotests: fix a number of problems with the tests on a 32-bit x86 system
root [Fri, 1 Mar 2019 22:01:23 +0000 (17:01 -0500)]
tests: fix a number of problems with the tests on a 32-bit x86 system

Verified on a 32-bit x86 Ubuntu 16.04.6 system.

Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agostyle: fix a 80-char line width issue
Paul Moore [Fri, 1 Mar 2019 22:03:08 +0000 (17:03 -0500)]
style: fix a 80-char line width issue

I had made this fix earlier when applying a patch, but forgot to
update the patch.

Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agoapi: provide 32-bit friendly argument comparison macros
Paul Moore [Tue, 15 Jan 2019 03:33:44 +0000 (22:33 -0500)]
api: provide 32-bit friendly argument comparison macros

We have a longstanding issue with 32-bit to 64-bit sign extension
inadvertently resulting in bogus syscall argument extensions. This
patch introduces a new set of argument comparison macros which
limit the argument values to 32-bit values so that we don't run into
problems with sign extension.

We use the macro overloading proposed by Roman at
https://kecher.net/overloading-macros/ to retain the feature of these
macros being usable as static initializers.

Thanks to @jdstrand on GitHub for reporting the problem.

Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
5 years agoarch: update the syscalls for Linux v5.0-rc5
Tom Hromatka [Fri, 8 Feb 2019 17:14:09 +0000 (10:14 -0700)]
arch: update the syscalls for Linux v5.0-rc5

Key changes include:
* Added __NR_statx, __NR_io_pgetevents, and __NR_rseq syscalls
  to seccomp.h.in
* mips architecture now generates some of its syscall header
  files.  Added logic to arch-syscall-validate to create these
  headers
* ppc architecture now uses a syscall.tbl
* s390 now uses a syscall.tbl

This addresses GitHub issue #136

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agodb: Return -EDOM on endian mismatch during arch add
Tom Hromatka [Tue, 5 Feb 2019 22:27:45 +0000 (15:27 -0700)]
db: Return -EDOM on endian mismatch during arch add

This commit clarifies the error code when seccomp_arch_add() or
seccomp_merge() fails due to an endian mismatch.  Previously,
libseccomp would return -EEXIST if the new architecture's
endianness did not match.

This addresses GitHub Issue #86 - BUG: seccomp_arch_add() returns
-EEXISTS on endian mismatch

Reported-by: Michael Vogt <michael.vogt@gmail.com>
Suggested-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agotools: update the .gitignore
Paul Moore [Thu, 7 Feb 2019 23:47:03 +0000 (18:47 -0500)]
tools: update the .gitignore

I forgot to add scmp_api_level to the .gitignore file.

Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agodb: fix a leak found by clang
Paul Moore [Tue, 5 Feb 2019 21:06:10 +0000 (16:06 -0500)]
db: fix a leak found by clang

Fix a leak found by clang where we were not cleaning up properly in
the error path.

    CC       libseccomp_la-db.lo
  db.c:2020:2: warning: Potential leak of memory pointed to by 'rule_s'
          _db_snap_release(snap);
          ^~~~~~~~~~~~~~~~

Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agotravis: update to ubuntu 16.04 (xenial)
Paul Moore [Tue, 5 Feb 2019 20:36:05 +0000 (15:36 -0500)]
travis: update to ubuntu 16.04 (xenial)

We are currently testing under Ubuntu 14.XX with Travis CI, it's time
to update to a more recent version of Ubuntu.

Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agoapi: renumber the pseudo syscall for subpage_prot()
Paul Moore [Sat, 22 Sep 2018 19:18:12 +0000 (15:18 -0400)]
api: renumber the pseudo syscall for subpage_prot()

Unfortunately the pseduo syscall number for subpage_prot() was
already in use by spu_run() so renumber it to a free pseduo syscall
number.

Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agotests: add an API level check to the live tests
Paul Moore [Sat, 22 Sep 2018 18:28:27 +0000 (14:28 -0400)]
tests: add an API level check to the live tests

Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agotools: add a new tool to detect the current API level
Paul Moore [Sat, 22 Sep 2018 18:15:33 +0000 (14:15 -0400)]
tools: add a new tool to detect the current API level

Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agotests: add openat() to the syscall whitelist in test 44
Paul Moore [Wed, 19 Sep 2018 21:17:31 +0000 (17:17 -0400)]
tests: add openat() to the syscall whitelist in test 44

Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agotests: Add tests for SECCOMP_RET_KILL_PROCESS
Tom Hromatka [Wed, 19 Sep 2018 15:32:41 +0000 (09:32 -0600)]
tests: Add tests for SECCOMP_RET_KILL_PROCESS

This addresses GitHub Issue #96 - RFE: add support for
SECCOMP_RET_KILL_PROCESS

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agoapi: Add support for SCMP_ACT_KILL_PROCESS
Tom Hromatka [Wed, 19 Sep 2018 15:26:25 +0000 (09:26 -0600)]
api: Add support for SCMP_ACT_KILL_PROCESS

This patch adds support for killing the entire process via
the SCMP_ACT_KILL_PROCESS action.  To maintain backward
compatibility, SCMP_ACT_KILL defaults to SCMP_ACT_KILL_THREAD.
Support for KILL_PROCESS was added into the Linux kernel in
v4.14.

This addresses GitHub Issue #96 - RFE: add support for
SECCOMP_RET_KILL_PROCESS

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
[PM: minor comment tweak in seccomp.h.in]
Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agopfc: fix PFC export hang on prioritized syscall with no rules (GH issue #117)
Tom Hromatka [Tue, 15 May 2018 13:56:56 +0000 (07:56 -0600)]
pfc: fix PFC export hang on prioritized syscall with no rules (GH issue #117)

github user @varqox reported that generating PFC will hang if the
libseccomp filter contains a syscalle with a priority but no rule
set.  The root cause is the while() loop in gen_pfc.c that walks
through the filter's syscalls.  It  wasn't properly advancing
through the list when p_iter was invalid.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
[PM: fix a comment in the test]
Signed-off-by: Paul Moore <paul@paul-moore.com>
5 years agopython: fix operands in MASKED_EQ documentation
Felix Abecassis [Fri, 1 Jun 2018 22:48:45 +0000 (15:48 -0700)]
python: fix operands in MASKED_EQ documentation

Fixes: https://github.com/seccomp/libseccomp/issues/119
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
[PM: used full URL in the fixes line]
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agobuild: enable distcheck'ing for the python code
Paul Moore [Thu, 10 May 2018 23:25:34 +0000 (19:25 -0400)]
build: enable distcheck'ing for the python code

I'm not particularly proud of the seccomp.pyx hack, but it works, and
enabling the python bindings during the distcheck is definitely the
"Greater Good".

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodocs: add the RELEASE_PROCESS.md file to the list of distributed files
Paul Moore [Thu, 10 May 2018 23:22:01 +0000 (19:22 -0400)]
docs: add the RELEASE_PROCESS.md file to the list of distributed files

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodoc: add git tag signing to the release process
Paul Moore [Thu, 10 May 2018 22:57:09 +0000 (18:57 -0400)]
doc: add git tag signing to the release process

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodocs: mention the GitHub milestones in the release process documentation
Paul Moore [Thu, 10 May 2018 22:50:55 +0000 (18:50 -0400)]
docs: mention the GitHub milestones in the release process documentation

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodb: convert the db_chain_* macros to functions
Paul Moore [Thu, 10 May 2018 16:57:11 +0000 (12:57 -0400)]
db: convert the db_chain_* macros to functions

In addition to converting the db_chain_* macros to functions, we also
move them into db.c and eliminate the unused macros/functions.

This change was originally suggested by Tom Hromatka
<tom.hromatka@oracle.com>.

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotravis: move from the bundled python to python "nightly" (3.7)
Paul Moore [Thu, 10 May 2018 21:44:07 +0000 (17:44 -0400)]
travis: move from the bundled python to python "nightly" (3.7)

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotravis: move the code coverage testing to the "after_success" stage
Paul Moore [Thu, 10 May 2018 20:59:49 +0000 (16:59 -0400)]
travis: move the code coverage testing to the "after_success" stage

For an as yet unknown reason we keep seeing build failures due to the
code coverage tests despite there not being any noticeable failures.
Move the gcov testing to "after_success" so that failures won't mark
the build as failing.

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoall: fixup all the file permissions
Paul Moore [Thu, 10 May 2018 17:51:08 +0000 (13:51 -0400)]
all: fixup all the file permissions

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoapi: seccomp_api_get() doesn't need to be marked as const
Paul Moore [Thu, 10 May 2018 16:31:57 +0000 (12:31 -0400)]
api: seccomp_api_get() doesn't need to be marked as const

Reported-by: Marek <deadbeef@popcount.org>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodoc: update the list of architectures in scmp_sys_resolver.1
James Cowgill [Thu, 22 Mar 2018 11:53:38 +0000 (11:53 +0000)]
doc: update the list of architectures in scmp_sys_resolver.1

Signed-off-by: James Cowgill <jcowgill@jcowgill.uk>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: add tests for db_chain_lt()
Tom Hromatka [Thu, 5 Apr 2018 21:39:21 +0000 (17:39 -0400)]
tests: add tests for db_chain_lt()

Add a test to improve the test coverage for db_chain_lt().

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
[PM: stripped the conversion from a macro to function, kept the test]
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: added tests for the A2 ordering bug (GH issue #112)
Tom Hromatka [Thu, 5 Apr 2018 18:57:24 +0000 (14:57 -0400)]
tests: added tests for the A2 ordering bug (GH issue #112)

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
[PM: subject line tweaks]
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodb: applied pcmoore's gist for GH issue #112
Tom Hromatka [Thu, 5 Apr 2018 18:57:23 +0000 (14:57 -0400)]
db: applied pcmoore's gist for GH issue #112

Note that as cited in the gist, this commit is not ready to be
committed yet.  Specifically:

* investigate _db_tree_prune(), that likely needs some logic (lt/gt)
  flipping to compensate for the changes in _db_tree_add()
* run the full regression test to ensure we aren't accidentally breaking
  anything
* separate patch to add this test case to the regression tests
* separate patch to clear up the macros in src/db.h, see db_chain_lt() as
  an example

Full gist is here:
https://gist.github.com/pcmoore/f644341a85c6ad7131a26f68f99e3fc6

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
[PM: subject line tweak, testing has proven this commit is OK and necessary
     to restore proper db ordering, also fix the 'make check-syntax' errors]
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodocs: add the supported ABIs to the README
Paul Moore [Tue, 13 Mar 2018 20:48:23 +0000 (16:48 -0400)]
docs: add the supported ABIs to the README

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agobuild: add a "help" make target for the top level Makefile
Paul Moore [Thu, 25 Jan 2018 12:31:13 +0000 (07:31 -0500)]
build: add a "help" make target for the top level Makefile

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodocs: add golang bindings pointer to README.md
Paul Moore [Thu, 25 Jan 2018 11:39:40 +0000 (06:39 -0500)]
docs: add golang bindings pointer to README.md

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodoc: convert the travis badge to use shields.io
Paul Moore [Thu, 18 Jan 2018 04:21:34 +0000 (23:21 -0500)]
doc: convert the travis badge to use shields.io

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodoc: update the coveralls badge to use shields.io
Paul Moore [Thu, 18 Jan 2018 04:16:13 +0000 (23:16 -0500)]
doc: update the coveralls badge to use shields.io

This is a workaround for the coveralls stale cache problem.

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: update the python tests
Paul Moore [Thu, 18 Jan 2018 03:05:18 +0000 (22:05 -0500)]
tests: update the python tests

Commit ce3dda9a1747 ("all: massive src/db.c rework") failed to update the
python tests to match the native/C tests; this patch fixes that oversight.

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoall: massive src/db.c rework
Paul Moore [Wed, 17 Jan 2018 22:49:46 +0000 (17:49 -0500)]
all: massive src/db.c rework

First, and most importantly, let me state that this is perhaps the worst
possible example of a patch I can think of, and if anyone tries to submit
a PR/patch like this one I will reject it almost immediately.  I'm only
merging this because 1) this patch escalated quickly, 2) splitting it would
require a disproportionate amount of time, and 3) this effort had blocked
other work for too long ... and, well, I'm the maintainer.  Consider this
a bit of "maintainer privilege" if you will.

This patch started simply enough: the goal was to add/augment some tests to
help increase the libseccomp test coverage.  Unfortunately, this particular
test improvement uncovered a rather tricky bug which escalated quite quickly
and soon involved a major rework of how we build the filter tree in src/db.c.
This rework brought about changes throughout the repository, including the
transaction and ABI specific code.

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: add some advanced syscall argument chain tests via 40-sim-adv_chains
Paul Moore [Tue, 21 Mar 2017 19:23:17 +0000 (15:23 -0400)]
tests: add some advanced syscall argument chain tests via 40-sim-adv_chains

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodb: make sure the tree branches end in actions
Paul Moore [Tue, 21 Mar 2017 19:16:00 +0000 (15:16 -0400)]
db: make sure the tree branches end in actions

When we remove a node from the tree we need to make sure it is
replaced with the appropriate action.

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agobpf: remove some dead code in _bpf_append_blk()
Paul Moore [Thu, 2 Mar 2017 23:10:38 +0000 (18:10 -0500)]
bpf: remove some dead code in _bpf_append_blk()

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: add a test to check for syscall priority function on non-native ABIs
Paul Moore [Thu, 2 Mar 2017 15:21:53 +0000 (10:21 -0500)]
tests: add a test to check for syscall priority function on non-native ABIs

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: exercise removing multiple ABIs from a filter
Paul Moore [Wed, 1 Mar 2017 23:00:53 +0000 (18:00 -0500)]
tests: exercise removing multiple ABIs from a filter

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: test for invalid filter attributes
Paul Moore [Wed, 1 Mar 2017 22:34:50 +0000 (17:34 -0500)]
tests: test for invalid filter attributes

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodoc: update the CHANGELOG and CREDITS for v2.3.3
Paul Moore [Wed, 10 Jan 2018 22:46:56 +0000 (17:46 -0500)]
doc: update the CHANGELOG and CREDITS for v2.3.3

Signed-off-by: Paul Moore <paul@paul-moore.com>
(imported from commit 1186e148c136f6d40483d51bd46eeaa33ca118ee)

6 years agotests: fix the live Python tests
Paul Moore [Wed, 10 Jan 2018 20:57:52 +0000 (15:57 -0500)]
tests: fix the live Python tests

Add the sigaltstack(2) syscall to the list of allowed syscalls; tested
against Python v3.6.4.

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoarch: update the syscalls for Linux v4.15-rc7
Paul Moore [Wed, 10 Jan 2018 17:16:28 +0000 (12:16 -0500)]
arch: update the syscalls for Linux v4.15-rc7

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoarch: add the statx syscall
Tobias Klauser [Fri, 20 Oct 2017 07:39:40 +0000 (09:39 +0200)]
arch: add the statx syscall

Fixes #88

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
[PM: fixed the incorrect x32 definition]
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: add test for SCMP_ACT_LOG of all syscalls
Tyler Hicks [Wed, 18 Oct 2017 06:16:57 +0000 (06:16 +0000)]
tests: add test for SCMP_ACT_LOG of all syscalls

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>
6 years agotests: add SCMP_ACT_LOG test to 06-sim-actions
Tyler Hicks [Wed, 18 Oct 2017 06:16:57 +0000 (06:16 +0000)]
tests: add SCMP_ACT_LOG test to 06-sim-actions

Extend the 06-sim-actions set of tests to include tests for
SCMP_ACT_LOG. The CTL_KCHECKACTS global attribute must be set to prevent
test errors when running under an old kernel that doesn't support
SECCOMP_RET_LOG.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: test suite infrastructure changes for SCMP_ACT_LOG
Tyler Hicks [Wed, 18 Oct 2017 06:16:56 +0000 (06:16 +0000)]
tests: test suite infrastructure changes for SCMP_ACT_LOG

The basics needed to handle tests that use the new SCMP_ACT_LOG
action.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoall: add support for new log action
Tyler Hicks [Wed, 18 Oct 2017 06:16:55 +0000 (06:16 +0000)]
all: add support for new log action

Extend libseccomp to support SECCOMP_RET_LOG, which is intended to
log the syscall before allowing it.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agosystem: runtime check if an action is supported by the kernel
Tyler Hicks [Wed, 18 Oct 2017 06:16:54 +0000 (06:16 +0000)]
system: runtime check if an action is supported by the kernel

As new actions are added to the kernel, libseccomp needs a way to
verify that an action is not only valid but also supported by the
current kernel at runtime. The only way to do this is by using the
SECCOMP_GET_ACTION_AVAIL operation which was added to seccomp(2) in
kernel version 4.14.

This check is not enabled for existing actions supported by libseccomp
since those actions were present in kernels at the inception of
libseccomp.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoall: add support for new log filter flag
Tyler Hicks [Wed, 18 Oct 2017 06:16:52 +0000 (06:16 +0000)]
all: add support for new log filter flag

Extend libseccomp to support SECCOMP_FILTER_FLAG_LOG, which is intended
to cause log events for all actions taken by a filter except for
SCMP_ACT_ALLOW actions. This is done via a new filter attribute called
SCMP_FLTATR_CTL_LOG that is off by default.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agosystem: runtime check if a filter flag is supported by the kernel
Tyler Hicks [Wed, 18 Oct 2017 06:16:47 +0000 (06:16 +0000)]
system: runtime check if a filter flag is supported by the kernel

As new filter flags are added to the kernel, libseccomp needs a way to
verify that a filter flag is not only valid but also supported by the
current kernel at runtime. A good way of doing that is by attempting to
enter filter mode, with the flag bit(s) in question set, and a NULL
pointer for the args parameter of seccomp(2). EFAULT indicates that the
flag is valid and EINVAL indicates that the flag is invalid. This patch
errs on the side of caution and treats any errno, besides EFAULT, as
indicating that the flag is invalid.

This check should be safe to use for the existing
SECCOMP_FILTER_FLAG_TSYNC flag so this patch enables the check for that
flag.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agopython: Expose API level functionality
Tyler Hicks [Tue, 10 Oct 2017 05:01:57 +0000 (05:01 +0000)]
python: Expose API level functionality

Allow Python applications to get and set the API level using global
functions.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: Improve seccomp_api_set() test coverage
Tyler Hicks [Mon, 9 Oct 2017 04:55:15 +0000 (04:55 +0000)]
tests: Improve seccomp_api_set() test coverage

Test setting all of the valid API levels and then test an invalid API
level to ensure that seccomp_api_set() fails.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoman: fix typo in seccomp_merge.3
Tobias Klauser [Thu, 19 Oct 2017 13:25:44 +0000 (15:25 +0200)]
man: fix typo in seccomp_merge.3

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoapi: Handle all possible return values when checking flag support
Tyler Hicks [Tue, 10 Oct 2017 15:41:06 +0000 (15:41 +0000)]
api: Handle all possible return values when checking flag support

When calling sys_chk_seccomp_flag(), ensure that a negative return value
is not incorrectly assumed to imply support of the flag.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agosystem: Add missing param to sys_chk_seccomp_flag() comment
Tyler Hicks [Mon, 9 Oct 2017 04:43:29 +0000 (04:43 +0000)]
system: Add missing param to sys_chk_seccomp_flag() comment

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: Add new API level test binary to gitignore
Tyler Hicks [Mon, 9 Oct 2017 04:40:06 +0000 (04:40 +0000)]
tests: Add new API level test binary to gitignore

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoapi: create an API level construct as part of the supported API
Paul Moore [Thu, 21 Sep 2017 14:27:38 +0000 (10:27 -0400)]
api: create an API level construct as part of the supported API

This patch adds the concept of "API levels" which are a way of
indicating what functionality is supported at runtime.  There are two
new API functions added, as explained by the manpage:

 "The seccomp_api_get() function returns an integer representing the
  functionality ("API level") provided by the current running kernel.
  It is important to note that while seccomp_api_get() can be called
  multiple times, the kernel is only probed the first time to see
  what functionality is supported, all following calls to
  seccomp_api_get() return a cached value.

  The seccomp_api_set() function allows callers to force the API
  level to the provided value; however, this is almost always a bad
  idea and use of this function is strongly discouraged."

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agobuild: fix Travis CI build/test failures
Paul Moore [Wed, 13 Sep 2017 17:17:42 +0000 (13:17 -0400)]
build: fix Travis CI build/test failures

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agoman: Fix SCMP_FLTATR_API_TSKIP typo in seccomp_attr_set man page
Tyler Hicks [Thu, 17 Aug 2017 00:06:01 +0000 (00:06 +0000)]
man: Fix SCMP_FLTATR_API_TSKIP typo in seccomp_attr_set man page

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agotests: fix conditional that was skipping all basic python tests
Tyler Hicks [Thu, 24 Aug 2017 19:28:13 +0000 (19:28 +0000)]
tests: fix conditional that was skipping all basic python tests

A conditional added in ec6f45ab was incorrectly comparing the (empty)
stdout of grep -q against 0, which always evaluated to be true and
skipped the basic python tests.

Fix it by using bash's pattern matching.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodoc: add Kyle R. Conway to the CREDITS file
Paul Moore [Mon, 19 Jun 2017 20:43:04 +0000 (16:43 -0400)]
doc: add Kyle R. Conway to the CREDITS file

Kyle designed the logo for libseccomp.

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodoc: rename SUBMITTING_PATCHES to CONTRIBUTING
Paul Moore [Mon, 19 Jun 2017 20:28:38 +0000 (16:28 -0400)]
doc: rename SUBMITTING_PATCHES to CONTRIBUTING

This is in better keeping with the convention of most Open Source
projects.

Signed-off-by: Paul Moore <paul@paul-moore.com>
6 years agodoc: add the logo to the README
Paul Moore [Mon, 19 Jun 2017 20:20:49 +0000 (16:20 -0400)]
doc: add the logo to the README

Thanks to Kyle R. Conway for the logo!
* https://github.com/seccomp/libseccomp-artwork

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agobuild: create an easy to use test coverage make target
Paul Moore [Wed, 1 Mar 2017 22:24:12 +0000 (17:24 -0500)]
build: create an easy to use test coverage make target

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agodoc: fix some small typos in SUBMITTING_PATCHES
Paul Moore [Tue, 28 Feb 2017 20:27:19 +0000 (15:27 -0500)]
doc: fix some small typos in SUBMITTING_PATCHES

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agodoc: add a note about writing new tests in SUBMITTING_PATCHES
Paul Moore [Tue, 28 Feb 2017 20:16:33 +0000 (15:16 -0500)]
doc: add a note about writing new tests in SUBMITTING_PATCHES

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agodoc: update the CHANGELOG for v2.3.2
Paul Moore [Mon, 27 Feb 2017 23:51:44 +0000 (18:51 -0500)]
doc: update the CHANGELOG for v2.3.2

Signed-off-by: Paul Moore <paul@paul-moore.com>
(imported from commit b1e97650bec2036029595ad81974ed79d0263544)

7 years agotests: we can't run fuzz tests on non-native filters
Paul Moore [Mon, 27 Feb 2017 21:55:21 +0000 (16:55 -0500)]
tests: we can't run fuzz tests on non-native filters

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: cleanup some comments in 15-sim-negative_one
Paul Moore [Mon, 27 Feb 2017 21:42:25 +0000 (16:42 -0500)]
tests: cleanup some comments in 15-sim-negative_one

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agobuild: fix arch-syscall-check for all supported architectures
Paul Moore [Mon, 27 Feb 2017 21:36:22 +0000 (16:36 -0500)]
build: fix arch-syscall-check for all supported architectures

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agobuild: fix a problem where arch-syscall-check could fail and return 0
Paul Moore [Mon, 27 Feb 2017 21:03:30 +0000 (16:03 -0500)]
build: fix a problem where arch-syscall-check could fail and return 0

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agodocs: update the CREDITS file
Paul Moore [Mon, 27 Feb 2017 17:15:27 +0000 (12:15 -0500)]
docs: update the CREDITS file

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agodocs: new tool to update the credits file
Paul Moore [Mon, 27 Feb 2017 17:05:40 +0000 (12:05 -0500)]
docs: new tool to update the credits file

This commit also adds a .mailmap file and updates the RELEASE_PROCESS
document to use the new script.

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: fix some problems with 'make distcheck'
Paul Moore [Mon, 27 Feb 2017 17:27:49 +0000 (12:27 -0500)]
tests: fix some problems with 'make distcheck'

This commit also renames some of the variables in the tests directory
to better reflect their meaning.

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agodocs: add a RELEASE_PROCESS document
Paul Moore [Fri, 24 Feb 2017 20:35:03 +0000 (15:35 -0500)]
docs: add a RELEASE_PROCESS document

This should help make releases much more consistent.

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agodoc: convert SUBMITTING_PATCHES to Markdown
Paul Moore [Fri, 24 Feb 2017 20:28:18 +0000 (15:28 -0500)]
doc: convert SUBMITTING_PATCHES to Markdown

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agodoc: update README.md with information about the "live" tests
Paul Moore [Fri, 24 Feb 2017 20:13:31 +0000 (15:13 -0500)]
doc: update README.md with information about the "live" tests

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agoall: update the .gitignore file to include gcov files and Python cache
Paul Moore [Fri, 24 Feb 2017 18:38:22 +0000 (13:38 -0500)]
all: update the .gitignore file to include gcov files and Python cache

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: add a dedicated PFC test
Paul Moore [Fri, 24 Feb 2017 07:31:59 +0000 (02:31 -0500)]
tests: add a dedicated PFC test

This commit also adds special shell-script handling for the "basic"
tests.

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: add the syscall consistency check to the code coverage tests
Paul Moore [Fri, 24 Feb 2017 06:57:57 +0000 (01:57 -0500)]
tests: add the syscall consistency check to the code coverage tests

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: add socket and ipc tests to 15-basic-resolver
Paul Moore [Fri, 24 Feb 2017 02:00:46 +0000 (21:00 -0500)]
tests: add socket and ipc tests to 15-basic-resolver

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agobpf: mark static functions as static
Paul Moore [Fri, 24 Feb 2017 15:33:35 +0000 (10:33 -0500)]
bpf: mark static functions as static

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agoall: mark a number of static functions as static
Paul Moore [Fri, 24 Feb 2017 00:48:46 +0000 (19:48 -0500)]
all: mark a number of static functions as static

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: add ipc(2) tests
Paul Moore [Thu, 23 Feb 2017 23:09:01 +0000 (18:09 -0500)]
tests: add ipc(2) tests

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: test the syscall resolver on all supported architectures
Paul Moore [Thu, 23 Feb 2017 21:52:50 +0000 (16:52 -0500)]
tests: test the syscall resolver on all supported architectures

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agoall: convert our hash from Lookup3 to MurmurHash3
Paul Moore [Thu, 23 Feb 2017 20:24:58 +0000 (15:24 -0500)]
all: convert our hash from Lookup3 to MurmurHash3

The hash implementation was taken from the GitHub project below
where it was released into the public domain.  MurmurHash3 should be
faster and less complex than the Lookup3 hash it replaces.

 * https://github.com/aappleby/smhasher

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agobpf: make sure we always clean up all of the BPF temporary state
Paul Moore [Thu, 23 Feb 2017 20:04:47 +0000 (15:04 -0500)]
bpf: make sure we always clean up all of the BPF temporary state

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: update the attr tests to include TSYNC and TSKIP
Paul Moore [Thu, 23 Feb 2017 18:49:18 +0000 (13:49 -0500)]
tests: update the attr tests to include TSYNC and TSKIP

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: add a test for seccomp_syscall_resolve_name_rewrite()
Paul Moore [Thu, 23 Feb 2017 18:20:23 +0000 (13:20 -0500)]
tests: add a test for seccomp_syscall_resolve_name_rewrite()

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agotests: test some untested arch APIs
Paul Moore [Thu, 23 Feb 2017 17:57:30 +0000 (12:57 -0500)]
tests: test some untested arch APIs

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agobpf: don't catch the -1 syscall in the x32/x86_64 check
Paul Moore [Wed, 15 Feb 2017 20:33:39 +0000 (15:33 -0500)]
bpf: don't catch the -1 syscall in the x32/x86_64 check

The -1 syscall can be used by a tracing process to skip a syscall,
which up until Linux v4.8 was of no concern for libseccomp since the
seccomp filter was only executed at the start of the syscall and not
after the tracing process was notified, however recent kernels also
execute the seccomp filter after the tracing process finishes its
syscall handling; this caused problems on x86_64 systems that didn't
explicitly add an x32 architecture to their filters.

This patch fixes the x32 check to treat the -1 syscall like any other
syscall.

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agoall: add tests to ensure that syscall -1 is handled correctly
Paul Moore [Wed, 15 Feb 2017 22:56:21 +0000 (17:56 -0500)]
all: add tests to ensure that syscall -1 is handled correctly

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agoall: treat syscall -1 as a valid syscall
Paul Moore [Thu, 16 Feb 2017 00:10:35 +0000 (19:10 -0500)]
all: treat syscall -1 as a valid syscall

Process tracers use a -1 syscall value to indicate that a syscall
should be skipped.  This turns out to be quite an undertaking as
we need to workaround __NR_SCMP_ERROR (which also has a value of
-1).  Pay special attention to the new attribute,
SCMP_FLTATR_API_TSKIP, and the documentation additions.

More information in the GitHub issue:
* https://github.com/seccomp/libseccomp/issues/80

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agoman: clarify syscall number rewriting
Luca Bruno [Mon, 11 Jul 2016 13:06:52 +0000 (15:06 +0200)]
man: clarify syscall number rewriting

In case of multiplexed syscalls, syscall name resolver and rule builder
both offer additional functions to ignore or perform syscall number
rewriting.
This commit introduces additional explicit details to the corresponding
manpages.

Signed-off-by: Luca Bruno <lucab@debian.org>
[PM: minor man-page style fixes]
Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agodoc: fix some of the man-page language
Paul Moore [Tue, 21 Feb 2017 21:43:39 +0000 (16:43 -0500)]
doc: fix some of the man-page language

See https://github.com/seccomp/libseccomp/issues/37

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agobuild: integrate Coverity scanning into the Travis CI build
Paul Moore [Mon, 20 Feb 2017 20:44:13 +0000 (15:44 -0500)]
build: integrate Coverity scanning into the Travis CI build

Signed-off-by: Paul Moore <paul@paul-moore.com>
7 years agoall: introduce a zmalloc() helper function
Paul Moore [Fri, 17 Feb 2017 20:57:56 +0000 (15:57 -0500)]
all: introduce a zmalloc() helper function

Signed-off-by: Paul Moore <paul@paul-moore.com>