[SoftCSA] Add double-buffered keys to eliminate data race in descrambling#3702
Merged
atvcaptain merged 2 commits intoopenatv:masterfrom Feb 10, 2026
Merged
[SoftCSA] Add double-buffered keys to eliminate data race in descrambling#3702atvcaptain merged 2 commits intoopenatv:masterfrom
atvcaptain merged 2 commits intoopenatv:masterfrom
Conversation
…ling setKey() (CWHandler thread) and descramble() (recorder thread) access the same dvbcsa_bs_key_t concurrently. key_set_ecm() rewrites the internal key schedule while decrypt() reads it, causing intermittent audio dropouts and brief freezes. Each parity now has two key slots. setKey() writes the inactive slot, then atomically publishes the new index (release). descramble() snapshots the active index once per call (acquire) and uses it throughout, so it never sees a partially-written key schedule.
- Check return value of ::write() calls to wake pipe - Replace EWOULDBLOCK with EINTR (EAGAIN == EWOULDBLOCK on Linux, causing -Werror=logical-op failure)
atvcaptain
pushed a commit
that referenced
this pull request
Feb 10, 2026
…ling (#3702) * [SoftCSA] Add double-buffered keys to eliminate data race in descrambling setKey() (CWHandler thread) and descramble() (recorder thread) access the same dvbcsa_bs_key_t concurrently. key_set_ecm() rewrites the internal key schedule while decrypt() reads it, causing intermittent audio dropouts and brief freezes. Each parity now has two key slots. setKey() writes the inactive slot, then atomically publishes the new index (release). descramble() snapshots the active index once per call (acquire) and uses it throughout, so it never sees a partially-written key schedule. * [cwhandler] Fix build warnings treated as errors - Check return value of ::write() calls to wake pipe - Replace EWOULDBLOCK with EINTR (EAGAIN == EWOULDBLOCK on Linux, causing -Werror=logical-op failure)
jbleyel
added a commit
that referenced
this pull request
Feb 12, 2026
* master: Use windowTitle parameter instead of setTitle after init of MessageBox [CAHandler] Send CMD_NOT_SELECTED when last service is unregistered [SoftCSA] Suppress activation when CI module handles decryption Revert "[SoftCSA] Deactivate software descrambling when CI module handles decryption" pot update translation update [servicedvb] * re-enable precise recovery feature to fix time shift issues * add extra setting for hardware latency correction for DM9x0 [ChannelSelection] Fix new crash https://www.opena.tv/viewtopic.php?p=597368&sid=6f7566164c0518ad0230b534dfb5889e#p597368 translation update [SoftCSA] Add double-buffered keys to eliminate data race in descrambling (#3702) [cahandler] Skip CLIENT_INFO on reconnects for legacy softcams (#3700)
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.
setKey() (CWHandler thread) and descramble() (recorder thread) access
the same dvbcsa_bs_key_t concurrently. key_set_ecm() rewrites the
internal key schedule while decrypt() reads it, causing intermittent
audio dropouts and brief freezes.
Each parity now has two key slots. setKey() writes the inactive slot,
then atomically publishes the new index (release). descramble() snapshots
the active index once per call (acquire) and uses it throughout, so it
never sees a partially-written key schedule.