Repository navigation
libobs: Wait for the whole destroy chain in obs_shutdown (UAF, Windows crash) - #653
Merged
Merged
Conversation
…ed (RED) Refs #649. test_group_teardown_uaf tears down the test_preview_audio_sources fixture and calls obs_shutdown; it segfaults after 'Double destroy' errors.
Destroying a scene queues the destruction of its items' sources behind the wait marker, and obs_wait_for_destroy_queue returned early without a video thread. obs_shutdown freed core data while nested scenes, groups and sources were still being destroyed (use after free in obs_sceneitem_destroy, a segfault on Windows). Wait on the destruction queue even without video/audio threads, and loop in obs_shutdown. Fixes #649
9 tasks done
Refs #649 Local-Gate: v1 tree=dbc3bf832cff89748e6b9baf0823694421947000 secs=345 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run Ci-Attestation: {"at":1791933424,"gate":"rust/all/fmt","host":"linux-x86_64","key":"ea91807ba085e91b85b65341f3d2c63e45288bc62e9d196a3451985e74fc357d","lane":"lint","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":29,"stamp":"191532f724332a3756a43129d2175e6d","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"} Ci-Attestation: {"at":1791933424,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"ea91807ba085e91b85b65341f3d2c63e45288bc62e9d196a3451985e74fc357d","lane":"lint","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":29,"stamp":"8d681481c29b973cb4186485f602df01","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"} Ci-Attestation: {"at":1791933424,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"72d608903e70c2c9087bf3b98e2970b1c2b1942508cf02add438a28945b57daf","lane":"rust-test","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":96,"stamp":"e9561ac721943c9987d4dcc3e5f5fc29","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"} Ci-Attestation: {"at":1791933424,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"601a865405849594c771af8a234a7f6d839bb00ee3ffca68abd11585941a5897","lane":"cross","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":85,"stamp":"1575b66f0871899fa55bbc4a04c327f0","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"} Ci-Attestation: {"at":1791933424,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"601a865405849594c771af8a234a7f6d839bb00ee3ffca68abd11585941a5897","lane":"cross","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":85,"stamp":"ed0cb085beb1ef634b9245aab9a0a2f8","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"} Ci-Attestation: {"at":1791933424,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"601a865405849594c771af8a234a7f6d839bb00ee3ffca68abd11585941a5897","lane":"cross","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":85,"stamp":"e05678c20b6eed00384de829e1ee3e4c","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"} Ci-Attestation: {"at":1791933424,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"601a865405849594c771af8a234a7f6d839bb00ee3ffca68abd11585941a5897","lane":"cross","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":85,"stamp":"357de131740502f0e92b20338d787faa","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"} Ci-Attestation: {"at":1791933424,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"601a865405849594c771af8a234a7f6d839bb00ee3ffca68abd11585941a5897","lane":"cross","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":85,"stamp":"841dcab1be263fce31913c1bbed4d03d","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"} Ci-Attestation: {"at":1791933424,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"601a865405849594c771af8a234a7f6d839bb00ee3ffca68abd11585941a5897","lane":"cross","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":85,"stamp":"815e931c208cd176d4d6c7ff929e7991","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"} Ci-Attestation: {"at":1791933424,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"c98f6a69678b57c9a10e3878f9c9a258eaf56d6efd6f72296139d270d20899c4","lane":"tier2-linux","parents":["48aa994b0bcefc3dc57588a4810563f6f9dff569"],"secs":134,"stamp":"a379d61575b86723843105d4b88a0c34","tree":"dbc3bf832cff89748e6b9baf0823694421947000","v":1,"via":"run"}
zackees
force-pushed
the
fix/sceneitem-destroy-uaf
branch
from
October 13, 2026 23:17
e40d240 to
2747512
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #649
Root cause: obs_shutdown waited for the destruction queue once, and obs_wait_for_destroy_queue returned immediately when no video/audio thread existed (test_preview_audio_sources calls obs_startup without obs_reset_video). Destroying a scene queues its items' sources behind the wait marker, so shutdown freed source types and core data while nested scenes/groups/sources were still being destroyed on the destruction thread: UAF in obs_sceneitem_destroy (signal_handler_disconnect on a freed source), the Windows segfault.
RED: d22c569 (test_group_teardown_uaf: same fixture, busy destruction thread, then obs_shutdown; fails with 'Double destroy' errors and SIGSEGV). GREEN: 48aa994 (wait even without video/audio threads, loop in obs_shutdown). Tier 2 (both ENABLE_RUST_LIBOBS lanes): 188/188 pass. Test runs under xvfb-run on Linux.
Not stamped by the local gate yet (another session held it; rebase invalidates a stamp anyway).