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)
Sun, Jun 21, 9:36 PM
Unknown Object (File)
Sat, Jun 20, 7:01 AM
Unknown Object (File)
Thu, Jun 18, 11:58 PM
Unknown Object (File)
Mon, Jun 1, 8:21 PM
Unknown Object (File)
Mon, Jun 1, 5:42 PM
Unknown Object (File)
Sat, May 30, 3:25 PM
Unknown Object (File)
May 21 2026, 10:43 PM
Unknown Object (File)
May 19 2026, 7:22 PM
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.