Page MenuHomeFreeBSD

sound: Address race between pcm_unregister() and dsp_close()
AbandonedPublic

Authored by christos on Nov 20 2025, 3:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jan 19, 8:35 PM
Unknown Object (File)
Sat, Jan 17, 4:21 PM
Unknown Object (File)
Dec 7 2025, 4:22 AM
Unknown Object (File)
Dec 4 2025, 8:34 AM
Unknown Object (File)
Dec 3 2025, 8:27 AM
Unknown Object (File)
Nov 27 2025, 8:13 PM
Unknown Object (File)
Nov 27 2025, 4:44 AM
Unknown Object (File)
Nov 21 2025, 12:12 AM
Subscribers
None

Details

Summary

There is an easily reproducable case (see modification in tests), where
pcm_unregister() will clear SD_F_REGISTERED and start killing channels
(pcm_killchans()), right before dsp_close() acquires the PCM lock, which
will can lead to a panic in dsp_close().

The fix is rather hacky and ugly, but it does the job for now.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68769
Build 65652: arc lint + arc unit

Event Timeline

christos created this revision.
christos retitled this revision from sound: Address race in dsp_close() to sound: Address race between pcm_unregister() and dsp_close().

Abandoning. It seems similar races exist across most syscalls, especially dsp_ioctl(). They can be triggered by running the test suite (with the patch here included) with -v parallelism=8.