opnsense-src/tests/sys
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
..
acl Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
aio aio_kqueue_test: Fix CID 1558429 2025-01-09 08:42:36 -06:00
audit Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
auditpipe Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
cam Make the CTL tests more resilient 2024-11-04 19:06:53 -07:00
capsicum capsicum tests: Serialize functional tests 2024-09-04 14:28:28 +00:00
cddl zfsd: replace vdevs with the AUX faulted state 2024-10-03 16:21:46 -06:00
common vnet tests: verify that we can load if_epair and if_bridge 2024-07-23 15:57:25 +02:00
compat32 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
devrandom Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
fifo Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
file path_test: adjust test for open(O_PATH | O_CREAT) 2025-01-07 04:46:19 +02:00
fs fusefs: fix the 32-bit build after 564c732b5c 2025-01-15 16:31:56 -07:00
geom ggate tests: Use unique ports among tests 2024-09-04 14:28:28 +00:00
kern tests/unix_stream: fix signedness error 2025-02-11 11:07:41 -08:00
kqueue Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
mac Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
mqueue Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
net kern: wg: remove overly-restrictive address family check 2025-03-04 13:57:34 -06:00
netgraph Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
netinet tests: Require python3 when using Scapy 2025-03-03 07:52:33 +00:00
netinet6 tests: Require python3 when using Scapy 2025-03-03 07:52:33 +00:00
netipsec Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
netlink netlink: underscore snl_get_genl_family_info() to discourage its use 2025-01-20 12:53:37 -08:00
netmap netmap: Disable a buggy and unsafe test (sync_kloop_conflict) 2025-03-06 13:22:25 -05:00
netpfil pf: fix nat64 ICMP translation 2025-03-05 10:37:57 +01:00
opencrypto Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
pjdfstest Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
posixshm shm: Respect PROT_MAX when creating private mappings 2024-10-04 15:56:34 +00:00
ses Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
sound sound tests: Fix downshift calculation in pcm_read_write test 2025-02-18 21:37:17 +02:00
sys tests: Add buf_ring overflow checks 2024-09-30 12:04:24 +00:00
vfs Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
vm shm: Respect PROT_MAX when creating private mappings 2024-10-04 15:56:34 +00:00
vmm vmm tests: Check for /dev/vmmctl to decide if vmm is initialized 2025-02-08 16:05:37 +00:00
Makefile ctl: add some ATF tests for READ BUFFER 2024-09-04 14:38:12 +00:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.inc Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00