freebsd kernel with SKQ
Go to file
Enji Cooper 33d7e3ee78 Merge the following changes from the capsicum-test project [1]
Log:
```
commit feb47278d7cffa8cf4bc8c8ff78047126fa41e82 (HEAD -> dev, origin/dev, origin/HEAD)
Author: ngie-eign <1574099+ngie-eign@users.noreply.github.com>
Date:   Fri Mar 22 10:51:04 2019 -0700

    Remove `FAIL` macro use for non-x86 architectures when testing `sysarch(2)` (#38)

    `FAIL()` does not support being called in the form noted in the test,
    which causes a test failure on non-x86 architectures.

    The alternatives (use `ADD_TEST_FAILURE()` or `GTEST_SKIP()`) would be
    misleading (in both cases), and in the case of `GTEST_SKIP()` is unavailable
    on the version of googletest packaged with capsicum-test.

    Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

commit 32ad0f3e4c11be7f7463d40eef8d4a78ac9f61a5
Author: Enji Cooper <yaneurabeya@gmail.com>
Date:   Fri Mar 15 20:01:56 2019 -0700

    Fix `-Wunused-parameter` issues

    Remove variable declarations from functions/methods where the variable
    is not required.

    Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

commit 9437b4c550110200ef190ac39fb26c1d8fc55d9a
Author: Enji Cooper <yaneurabeya@gmail.com>
Date:   Fri Mar 15 19:59:00 2019 -0700

    Fix `-Wshadow` issues with `EXPECT_OPEN_OK(..)` macro

    * Wrap in do-while(0) block to avoid variable shadowing issue with
      multiple calls in the same function.
    * Prefix block local variables with `_` to try and avoid variable
      name clashes with values local to test methods.

    Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

commit adf4a21a233b5da5cac440f4006e258ffba09510
Author: Enji Cooper <yaneurabeya@gmail.com>
Date:   Fri Mar 15 19:55:00 2019 -0700

    Fix `-Wmissing-variable-declarations` issue with `known_rights` global

    Staticize it since it is only used in the file.

    Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
```

This merges a number of the outstanding changes made locally to
^/projects/capsicum-test that were accepted into the upstream project.

The sync was done like so:
```
curl -L https://github.com/google/capsicum-test/tarball/dd7eac98c0cf | tar --strip-components=1 -xvzf - -C dist/
rm -Rf dist/*/
```

1. https://github.com/google/capsicum-test
2019-03-29 21:41:14 +00:00
.gitignore Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
capability-fd-pair.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
capability-fd.cc Merge the following changes from the capsicum-test project [1] 2019-03-29 21:41:14 +00:00
capmode.cc Merge the following changes from the capsicum-test project [1] 2019-03-29 21:41:14 +00:00
capsicum-freebsd.h Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
capsicum-linux.h Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
capsicum-rights.h Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
capsicum-test-main.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
capsicum-test.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
capsicum-test.h Merge the following changes from the capsicum-test project [1] 2019-03-29 21:41:14 +00:00
capsicum.h Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
CONTRIBUTING.md Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
fcntl.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
fexecve.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
GNUmakefile Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
ioctl.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
LICENSE Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
linux.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
makefile Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
mini-me.c Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
mqueue.cc Merge the following changes from the capsicum-test project [1] 2019-03-29 21:41:14 +00:00
openat.cc Merge the following changes from the capsicum-test project [1] 2019-03-29 21:41:14 +00:00
overhead.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
procdesc.cc Merge the following changes from the capsicum-test project [1] 2019-03-29 21:41:14 +00:00
README.md Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
rename.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
sctp.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
select.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
showrights Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
smoketest.c Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
socket.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
syscalls.h Merge the following changes from the capsicum-test project [1] 2019-03-29 21:41:14 +00:00
sysctl.cc Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00
waittest.c Import capsicum-test into ^/vendor/google/capsicum-test/dist 2019-03-12 01:43:01 +00:00

Capsicum User Space Tests

This directory holds unit tests for Capsicum object-capabilities. The tests exercise the syscall interface to a Capsicum-enabled operating system, currently either FreeBSD >=10.x or a modified Linux kernel (the capsicum-linux project).

The tests are written in C++98, and use the Google Test framework, with some additions to fork off particular tests (because a process that enters capability mode cannot leave it again).

Provenance

The original basis for these tests was:

  • unit tests written by Robert Watson and Jonathan Anderson for the original FreeBSD 9.x Capsicum implementation
  • unit tests written by Meredydd Luff for the original Capsicum-Linux port.

These tests were coalesced and moved into an independent repository to enable comparative testing across multiple OSes, and then substantially extended.

OS Configuration

Linux

The following kernel configuration options are needed to run the tests:

  • CONFIG_SECURITY_CAPSICUM: enable the Capsicum framework
  • CONFIG_PROCDESC: enable Capsicum process-descriptor functionality
  • CONFIG_DEBUG_FS: enable debug filesystem
  • CONFIG_IP_SCTP: enable SCTP support

FreeBSD (>= 10.x)

The following kernel configuration options are needed so that all tests can run:

  • options P1003_1B_MQUEUE: Enable POSIX message queues (or kldload mqueuefs)

Other Dependencies

Linux

The following additional development packages are needed to build the full test suite on Linux.

  • libcaprights: See below
  • libcap-dev: Provides headers for POSIX.1e capabilities.
  • libsctp1: Provides SCTP library functions.
  • libsctp-dev: Provides headers for SCTP library functions.

Linux libcaprights

The Capsicum userspace library is held in the libcaprights/ subdirectory. Ideally, this library should be built (with ./configure; make or dpkg-buildpackage -uc -us) and installed (with make install or dpkg -i libcaprights*.deb) so that the tests will use behave like a normal Capsicum-aware application.

However, if no installed copy of the library is found, the GNUmakefile will attempt to use the local libcaprights/*.c source; this requires ./configure to have been performed in the libcaprights subdirectory. The local code is also used for cross-compiled builds of the test suite (e.g. make ARCH=32 or make ARCH=x32).