Repository navigation
Description
Unit
libobs/callback/signal.c.h (signal.h): signal_handler_create, _destroy, _add, _connect, _connect_ref, _disconnect, _connect_global, _disconnect_global, _remove_current, _signal. The event system of the libobs core. Target crate: obs-callback. Part of #1437.
Phase and position
Last slice: it needs decl and calldata and has the most state. Users: 12 libobs files, 15 plugin files, 16 frontend files. If the characterization shows parts that can be separated (for example the global callbacks), this can split into two PRs.
Dependencies and existing tests
decl, calldata, threading (recursive mutexes, atomics; ported), darray/bmem (ported). No cmocka test for the handler itself. Steps: characterization test test/cmocka/test_signal.c, RED, GREEN, Tier 3 against the C oracle, plus a concurrency test (connect and disconnect from other threads while signalling) under TSan.
Notes
To characterize:
- Disconnect while the signal runs only marks the callback (
remove), and the signal loop erases it after the callbacks run. Connect while it runs appends. signal_handler_remove_currentuses thread-local pointers to the running callback (current_signal_cb,current_global_cb).keep_ref(signal_handler_connect_ref) adds a reference to the handler, and the handler is freed when the last reference goes (signal_handler_destroydrops one).- The per-signal and global-callback mutexes are recursive, the handler mutex is not.
- Logged cases: an invalid declaration, a signal that exists, a connect to a signal that is not there.
To check during characterization (not confirmed): if a callback connects to the same signal while it runs and da_push_back reallocates the array, the thread-local current_signal_cb may point into the old array for a later signal_handler_remove_current in that callback.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
vpacher commentedon Oct 19, 2026
Claiming: #1441
First steps: the characterization test
test/cmocka/test_signal.cagainst the C (registered intests.d/), then the port intorust/obs-callbackwith RED and GREEN and a Tier 3 test against the C oracle. The test pins connect and disconnect, global handlers, a disconnect during a signal (deferred remove),keep_refrefcounting, and a connect during a signal (the handler array can reallocate whilecurrent_signal_cbpoints into it).test: characterize callback/signal.c before port (Refs obs-rust#1441) (…
vpacher commentedon Oct 21, 2026
Status: the Rust port of signal.c is done locally and rebased onto #1556 (Tier 1 and Tier 3 green, the C test cases mirrored). @zackees, could you check your inbox for it? I am still on this issue. I hold the PR until I have an answer to the email I sent on 2026-10-20.
zackees commentedon Oct 21, 2026
@vpacher The report you mean is the private advisory you filed on 2026-10-19 for libobs/callback/signal.c. Here are the answers to your questions:
Sorry for the slow reply on the advisory. Thanks for reporting it privately.
zackees commentedon Oct 21, 2026
@vpacher The maintainer has decided on the private advisory you filed on 2026-10-20 (see its description), and its private fork is ready for your fix.
vpacher commentedon Oct 21, 2026
@zackees Thanks. I think you missed a comment I left in the advisory earlier today (about 2:20 a.m. PDT). Can you re-check it, please, before I push?
zackees commentedon Oct 21, 2026
@vpacher You're right, and I'm sorry: I missed your 09:17Z comment on GHSA-rjwf. #1556 fixed only the signal-callback part, and the advisory was published while the global-callback part is still on master. Comments on it are now closed, so I'm answering here.
Because the advisory is already public, keeping the fix private no longer helps. Please open the C fix (track the global callback by index, as you described), its RED test and your signal.c port as normal public PRs now, and link them here. They'll go through the merge queue as soon as they're green. I've marked the advisory as partly fixed until then. Nobody else is pushing a fix; it's yours.
vpacher commentedon Oct 21, 2026
PR A: #1639 (C fix for the global callbacks, RED then GREEN). The signal.c port follows on top of it.
zackees commentedon Oct 21, 2026
@vpacher Thanks. #1639 is green and in the merge queue. After it lands, please confirm on #1639 that both reproductions from your report now pass. I'll then take the "partly fixed" note off GHSA-rjwf.
vpacher commentedon Oct 21, 2026
PR B: #1642 (signal.c port, Fixes #1441). #1639 is merged; I'll confirm the reproductions on #1639 next.
obs-callback: swap signal_handler to Rust (Refs obs-rust#1441)
callback: Track the running global signal callback by index (obs-rust…
obs-callback: Port signal.c to Rust (obs-rust#1642)