OPNsense - FreeBSD source
Find a file
John Baldwin ecb3a7d43d netmap: Disable a buggy and unsafe test (sync_kloop_conflict)
This test starts two threads to verify that two concurrent threads
cannot enter the kernel loop on the same netmap context.  The test
even has a comment about a potential race condition where the first
thread enters the loop and is stopped before the second thread tries
to enter the loop.  It claims it is fixed by the use of a semaphore.
Unfortunately, the semaphore doesn't close the race.

In the CI setup for CHERI, we run the testsuite once a week against
various architectures using single CPU QEMU instances.  Across
multiple recent runs of the plain "aarch64" test the job ran for an
entire day before QEMU was killed by a timeout.  The last messages
logged were from this test:

734.881045 [1182] generic_netmap_attach     Emulated adapter for tap3312 created (prev was NULL)
734.882340 [ 321] generic_netmap_register   Emulated adapter for tap3312 activated
734.882675 [2224] netmap_csb_validate       csb_init for kring tap3312 RX0: head 0, cur 0, hwcur 0, hwtail 0
734.883042 [2224] netmap_csb_validate       csb_init for kring tap3312 TX0: head 0, cur 0, hwcur 0, hwtail 1023
734.915397 [ 820] netmap_sync_kloop         kloop busy_wait 1, direct_tx 0, direct_rx 0, na_could_sleep 0
736.901945 [ 820] netmap_sync_kloop         kloop busy_wait 1, direct_tx 0, direct_rx 0, na_could_sleep 0

From the timestamps, the synchronous kloop was entered twice 2 seconds
apart.  This corresponds to the 2 second timeout on the semaphore in
the test.  What appears to have happened is that th1 started and
entered the kernel where it spun in an endless busy loop.  This
starves th2 so it _never_ runs.  Once the semaphore times out, th1 is
preempted to run the main thread which invokes the ioctl to stop the
busy loop.  th1 then exits the loop and returns to userland to exit.
Only after this point does th2 actually run and execute the ioctl to
enter the kernel.  Since th1 has already exited, th2 doesn't error and
enters its own happy spin loop.  The main thread hangs forever in
pthread_join, and the process is unkillable (the busy loop in the
kernel doesn't check for any pending signals so kill -9 is ignored and
ineffective).

I don't see a way to fix this test, so I've just disabled it.  There
is no good way to ensurce concurrency on a single CPU system when one
thread wants to sit in a spin loop.  Someone should fix the netmap
kloop to respond to kill -9 in which case kyua could perhaps at least
timeout the individual test process and kill it.

Reviewed by:	vmaffione
Obtained from:	CheriBSD
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D49220
2025-03-06 13:22:25 -05:00
.cirrus-ci Cirrus-CI: add some timing info on pkg install failure 2021-08-04 15:02:00 -04:00
.github Vendor import of OpenSSH 9.9p2 2025-02-18 21:47:51 -05:00
bin sh.1: extend the section about getopts 2025-02-27 18:39:29 +01:00
cddl zfs: merge openzfs/zfs@6a2f7b384 2025-02-20 17:40:55 +01:00
contrib ntp: NULL pointer deref when create_interface() fails 2025-02-28 07:53:22 -08:00
crypto openssh: Fix blacklistd sshd-session integration 2025-02-24 14:38:52 +00:00
etc mtree: Add missing flua/freebsd/sys entry 2025-02-05 19:53:23 +00:00
gnu Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
include range_tree: convert remaining range_* defs to zfs_range_* 2025-02-14 15:37:56 -08:00
kerberos5 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
lib libc: fix _FORTIFY_SOURCE build on aarch64 2025-03-04 13:53:34 -06:00
libexec libc/gen: split user-visible opendir()-like functions into separate source files 2025-02-25 09:09:29 +02:00
release acpi_pci: Add quirk for PSTAT_PME-before-detach 2025-03-05 12:25:49 -08:00
rescue nvmf: Switch several ioctls to using nvlists 2024-12-30 13:52:21 -05:00
sbin ipf: Correct ippool.5 man page 2025-03-04 12:39:07 -08:00
secure ssh: Consolidate HAVE_LDNS / LIBWRAP in ssh.mk 2025-02-20 18:33:46 -05:00
share witness.4: correct name of the debug.witness.witness_count sysctl 2025-03-05 11:52:14 -07:00
stand loader: dosfs should be able to work with different sector sizes 2025-03-03 23:54:23 +02:00
sys pfkey2: use correct value for a key length 2025-03-06 15:18:59 +03:00
targets gvinum(8): Remove userland tool for managing vinum volumes 2025-01-23 11:20:43 -05:00
tests netmap: Disable a buggy and unsafe test (sync_kloop_conflict) 2025-03-06 13:22:25 -05:00
tools wlanwatch: clean up to compile / run 2025-02-27 18:49:49 -08:00
usr.bin top: Make locale issues non-fatal. 2025-03-06 14:59:23 +01:00
usr.sbin jail: add jexec -d, to specify a working directory 2025-03-05 02:14:47 -08:00
.arcconfig arcanist: use FreeBSD/git project repository instead of FreeBSD/svn 2022-08-23 14:16:41 +00:00
.arclint
.cirrus.yml .cirrus-ci: Update the non-manual GCC build job to GCC 14 2025-03-03 11:51:47 -05:00
.clang-format clang-format: Minor tweaks 2024-04-30 17:33:43 -04:00
.git-blame-ignore-revs git-blame-ignore-revs: list rtld-elf reformatting 2025-01-21 03:57:21 +02:00
.gitattributes Remove SVN related Git attributes 2023-12-26 10:28:28 -07:00
.gitignore .gitignore: add sys/*/compile 2024-02-02 09:20:36 -07:00
.mailmap mailmap: Translate my personal address 2024-06-22 08:57:56 +02:00
CONTRIBUTING.md CONTRIBUTING.md/style: spring cleaning 2024-05-10 15:07:03 -06:00
COPYRIGHT copyright: Happy New Year 2025 2025-01-01 00:04:28 +00:00
LOCKS Update LOCKS for Git 2023-12-26 10:28:25 -07:00
MAINTAINERS man filesystems: fix more xrefs after move to s4 2024-06-27 18:32:05 -06:00
Makefile universe: Update the default GCC toolchain to GCC 14 2025-03-03 11:51:53 -05:00
Makefile.inc1 pkgbase: make pkg repo reproducible 2025-03-06 15:22:48 +01:00
Makefile.libcompat Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.sys.inc Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ObsoleteFiles.inc ObsoleteFiles.inc: Remove test debug file from wrong dir 2025-02-13 17:05:33 +00:00
README.md Update README.md to add pointer to release page. 2024-05-09 20:40:46 -06:00
RELNOTES RELNOTES: Add 02d4eeabfd note 2025-02-25 13:58:25 +02:00
UPDATING ipfw: add UPDATING note and modify __FreeBSD_version 2025-03-03 21:58:24 +03:00

FreeBSD Source:

This is the top level of the FreeBSD source directory.

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.

For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.

The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.

For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.

For official FreeBSD bootable images, see the release page.

Source Roadmap:

Directory Description
bin System/user commands.
cddl Various commands and libraries under the Common Development and Distribution License.
contrib Packages contributed by 3rd parties.
crypto Cryptography stuff (see crypto/README).
etc Template files for /etc.
gnu Commands and libraries under the GNU General Public License (GPL) or Lesser General Public License (LGPL). Please see gnu/COPYING and gnu/COPYING.LIB for more information.
include System include files.
kerberos5 Kerberos5 (Heimdal) package.
lib System libraries.
libexec System daemons.
release Release building Makefile & associated tools.
rescue Build system for statically linked /rescue utilities.
sbin System commands.
secure Cryptographic libraries and commands.
share Shared resources.
stand Boot loader sources.
sys Kernel sources (see sys/README.md).
targets Support for experimental DIRDEPS_BUILD
tests Regression tests which can be run by Kyua. See tests/README for additional information.
tools Utilities for regression testing and miscellaneous tasks.
usr.bin User commands.
usr.sbin System administration commands.

For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.