opnsense-src/contrib/capsicum-test
Ed Maste a6716e8cb1 sigqueue: In capability mode, only allow signalling self
This is copied from the check in kern_kill.

Approved by:	so
Security:	FreeBSD-SA-26:28.capsicum
Security:	CVE-2026-45259
Reviewed by:	markj, oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57244

(cherry picked from commit b9d16b7fd2fa6bc4b3e8364804cbdc1b76ebe8a5)
(cherry picked from commit defd9b86ef995ce70363eae9b323d616bda865be)
(cherry picked from commit d11ff01b3aec336128e6babbff7a421fbce82015)
2026-06-10 08:42:37 +02:00
..
.gitignore Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
capability-fd-pair.cc Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
capability-fd.cc capsicum: introduce cap_rights_is_empty Function 2024-06-05 11:55:17 -04:00
capmode.cc sigqueue: In capability mode, only allow signalling self 2026-06-10 08:42:37 +02:00
capsicum-freebsd.h capsicum-test: rights are propagated on sctp_peeloff(2) 2024-10-17 12:29:21 -04:00
capsicum-linux.h Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
capsicum-rights.h Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
capsicum-test-main.cc Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b 2021-02-16 14:35:12 +00:00
capsicum-test.cc Merge commit 'd0e943077d94e6266ece9856789c5d5313676e38' 2021-04-12 11:29:47 -04:00
capsicum-test.h Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40 2021-03-02 16:38:05 +00:00
capsicum.h Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
CONTRIBUTING.md Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
fcntl.cc Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
fexecve.cc Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b 2021-02-16 14:35:12 +00:00
GNUmakefile Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40 2021-03-02 16:38:05 +00:00
ioctl.cc Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
LICENSE Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
linux.cc Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b 2021-02-16 14:35:12 +00:00
makefile Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40 2021-03-02 16:38:05 +00:00
mini-me.c Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
mqueue.cc Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b 2021-02-16 14:35:12 +00:00
openat.cc capsicum-test: Update for O_BENEATH removal 2021-03-12 17:12:10 +00:00
overhead.cc Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
procdesc.cc Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40 2021-03-02 16:38:05 +00:00
README.md Merge commit 'd0e943077d94e6266ece9856789c5d5313676e38' 2021-04-12 11:29:47 -04:00
rename.cc Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
sctp.cc capsicum-test: include SCTP tests 2024-10-11 11:24:55 -04:00
select.cc Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
showrights Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
smoketest.c Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
socket.cc Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40 2021-03-02 16:38:05 +00:00
syscalls.h Update capsicum-test to eab7a83b05becf64439b4b256b3d756b353fbbbb 2022-09-13 13:42:46 -04:00
sysctl.cc Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +00:00
waittest.c Integrate capsicum-test into the FreeBSD test suite 2019-04-01 21:24:50 +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++11 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).