]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Integrate capsicum-test into the FreeBSD test suite
authorngie <ngie@FreeBSD.org>
Mon, 1 Apr 2019 21:24:50 +0000 (21:24 +0000)
committerngie <ngie@FreeBSD.org>
Mon, 1 Apr 2019 21:24:50 +0000 (21:24 +0000)
commit631df11d046c22f9c492f599e6fbb4f1b25f3696
tree60aea5eff4b9cf943e2c6e3100a9f0878a53590b
parent40ef4fde4d6eb1e1b26b3dc975b48f50c94f6ee8
parent3105399b23ebfd37ebe1a44f73551887f6b25399
Integrate capsicum-test into the FreeBSD test suite

This change takes capsicum-test from upstream and applies some local changes to make the
tests work on FreeBSD when executed via Kyua.

The local modifications are as follows:
1. Make `OpenatTest.WithFlag` pass with the new dot-dot lookup behavior in FreeBSD 12.x+.
2. capsicum-test references a set of helper binaries: `mini-me`, `mini-me.noexec`, and
   `mini-me.setuid`, as part of the execve/fexecve tests, via execve, fexecve, and open.
   It achieves this upstream by assuming `mini-me*` is in the current directory, however,
   in order for Kyua to execute `capsicum-test`, it needs to provide a full path to
   `mini-me*`. In order to achieve this, I made `capsicum-test` cache the executable's
   path from argv[0] in main(..) and use the cached value to compute the path to
   `mini-me*` as part of the execve/fexecve testcases.
3. The capsicum-test test suite assumes that it's always being run on CAPABILITIES enabled
   kernels. However, there's a chance that the test will be run on a host without a
   CAPABILITIES enabled kernel, so we must check for the support before running the tests.
   The way to achieve this is to add the relevant `feature_present("security_capabilities")`
   check to SetupEnvironment::SetUp() and skip the tests when the support is not available.
   While here, add a check for `kern.trap_enotcap` being enabled. As noted by markj@ in
   https://github.com/google/capsicum-test/issues/23, this sysctl being enabled can trigger
   non-deterministic failures. Therefore, the tests should be skipped if this sysctl is
   enabled.

All local changes have been submitted to the capsicum-test project
(https://github.com/google/capsicum-test) and are in various stages of review.
Please see the following pull requests for more details:
1. https://github.com/google/capsicum-test/pull/35
2. https://github.com/google/capsicum-test/pull/41
3. https://github.com/google/capsicum-test/pull/42

Reviewed by: asomers
Discussed with: emaste, markj
Approved by: emaste (mentor)
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D19758
35 files changed:
contrib/capsicum-test/.gitignore
contrib/capsicum-test/CONTRIBUTING.md
contrib/capsicum-test/GNUmakefile
contrib/capsicum-test/LICENSE
contrib/capsicum-test/README.md
contrib/capsicum-test/capability-fd-pair.cc
contrib/capsicum-test/capability-fd.cc
contrib/capsicum-test/capmode.cc
contrib/capsicum-test/capsicum-freebsd.h
contrib/capsicum-test/capsicum-linux.h
contrib/capsicum-test/capsicum-rights.h
contrib/capsicum-test/capsicum-test-main.cc
contrib/capsicum-test/capsicum-test.cc
contrib/capsicum-test/capsicum-test.h
contrib/capsicum-test/capsicum.h
contrib/capsicum-test/fcntl.cc
contrib/capsicum-test/fexecve.cc
contrib/capsicum-test/ioctl.cc
contrib/capsicum-test/linux.cc
contrib/capsicum-test/makefile
contrib/capsicum-test/mini-me.c
contrib/capsicum-test/mqueue.cc
contrib/capsicum-test/openat.cc
contrib/capsicum-test/overhead.cc
contrib/capsicum-test/procdesc.cc
contrib/capsicum-test/rename.cc
contrib/capsicum-test/sctp.cc
contrib/capsicum-test/select.cc
contrib/capsicum-test/showrights
contrib/capsicum-test/smoketest.c
contrib/capsicum-test/socket.cc
contrib/capsicum-test/syscalls.h
contrib/capsicum-test/sysctl.cc
contrib/capsicum-test/waittest.c
tests/sys/capsicum/Makefile