Skip to content

libobs: Wait for the whole destroy chain in obs_shutdown (UAF, Windows crash) - #653

Merged
zackees merged 3 commits into
masterfrom
fix/sceneitem-destroy-uaf
Oct 13, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/sceneitem-destroy-uaf

Conversation

@zackees

@zackees zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member

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).

…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
@zackees zackees added the ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak label Oct 13, 2026
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
zackees force-pushed the fix/sceneitem-destroy-uaf branch from e40d240 to 2747512 Compare October 13, 2026 23:17
@zackees
zackees merged commit 195f6ab into master Oct 13, 2026
24 checks passed
@zackees
zackees deleted the fix/sceneitem-destroy-uaf branch October 26, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[crash] libobs: scene item destroyed after its source on group/scene teardown (UAF, Windows)

1 participant