opnsense-src/tests/sys
Mark Johnston cf42166fdd sound: Revalidate after reacquiring locks when resizing buffers
sndbuf_resize() and sndbuf_remalloc() drop the channel lock in order to
allocate the new buffer(s) with M_WAITOK.  Before doing that they verify
that the buffer is not mapped, but this could change while the lock is
dropped, as there is no higher-level synchronization which prevents
buffer resize (e.g., via the SNDCTL_DSP_SETBLKSIZE ioctl) from happening
concurrently with mmap.  Thus, these checks are insufficient.

Modify sndbuf_resize() and sndbuf_remalloc() to revalidate after
reacquiring the lock.  Extend them to check for a couple of channel
flags, mirroring the check in chn_resizebuf().  Modify chn_resizebuf()
to revalidate state after reacquiring the channel lock.

We could also allocate new buffers with M_NOWAIT and so avoid dropping
the lock.  Then, I think we could go even further and invoke
CHANNEL_SETBLOCKSIZE and CHANNEL_SETFRAGMENTS with the channel lock
held.  But really it would be better to ensure that dsp operations are
serialized; there is no reason for mmap and chn_resizebuf() to be able
to run in parallel, we should not be relying on the channel lock for
this.  So, let's keep a more minimal approach here.

Add a simple regression test.

Approved by:	so
Security:	FreeBSD-SA-26:71.sound
Security:	CVE-2026-101308
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D60554
2026-10-15 11:28:55 +02:00
..
acl Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
aio aio(4) tests: do not rely on (int *)-1 being invalid address 2026-03-26 08:45:17 -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 CTL: add ATF tests for REPORT SUPPORTED OPCODES 2026-04-30 11:24:06 -06:00
capsicum sigqueue: In capability mode, only allow signalling self 2026-06-09 02:59:42 +00:00
cddl zfsd: don't try to fix an OFFLINE condition 2025-08-04 10:00:52 -06:00
common tests: disable transmit checksum offloading for epair interfaces 2025-09-04 13:52:37 +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 closefrom_test: Convert to atf-c(3) 2025-12-18 13:42:23 -05:00
fs fdescfs: Pass up additional metadata during lookups 2026-09-30 11:46:46 +02:00
geom tests: Increase timeout 2026-01-20 16:36:55 +00:00
kern ktls: Fix an off-by-one bug in tls13_find_record_type() 2026-09-30 11:46:52 +02:00
kqueue kqueue: Avoid enqueuing an already-enqueued knote 2026-08-11 07:43:51 +02:00
mac tests: Increase timeout 2026-01-20 16:36:55 +00:00
mqueue Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
net wg(4): Add a test that the driver handles a decryption failure 2026-08-11 07:43:58 +02:00
netgraph tests/netgraph: Add a test for races between if_detach() and vnet_if_return() 2026-04-30 17:52:02 +08:00
netinet bind(2): Lookup local address in current FIB if '*.bind_all_fibs' is active 2026-09-14 07:30:53 +02:00
netinet6 tests: Add some simple regression tests for ip_mroute 2026-09-14 07:26:27 +02:00
netipsec tests: fix test for NULL encription 2025-03-25 10:23:40 +03:00
netlink netlink: Move static arrays of parsers into tests that use them 2025-04-11 09:52:39 -04:00
netmap netmap: Disable a buggy and unsafe test (sync_kloop_conflict) 2025-03-06 13:22:25 -05:00
netpfil pf: set the correct type for rule timeouts 2026-10-07 07:51:28 +02: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 posixshm: Fix handling of sendfile() with largepage objects 2026-07-06 10:29:39 +02:00
ses
sound sound: Revalidate after reacquiring locks when resizing buffers 2026-10-15 11:28:55 +02:00
sys bitstring_test: fix bit_nclear/bit_nset tests for last iteration 2025-10-28 02:20:35 -07:00
vfs Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
vm device_pager: Avoid double-insertion of pages into the pager list 2026-07-06 10:29:21 +02: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
Makefile.inc Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00