checklocks: fix TCP atomic state access - #14336
Closed
tamird wants to merge 2 commits into
Closed
Conversation
The send-buffer option callback atomically disables autotuning without holding the endpoint or send queue mutex. Endpoint probes copy that flag under the queue mutex, so their RacyLoad can race with the callback. 96459f5 introduced the atomic flag alongside a non-atomic state snapshot; ef9e8d9 preserved the race in CloneState. Load and store the snapshot flag atomically, declare its atomic contract and the queue lock precondition, and retain exclusive ownership of the destination. Extend the endpoint-probe test with a concurrent option callback to exercise the conflicting accesses through real packet processing. Assisted-by: Codex
Readiness and shutdown can update the connection-direction cache under different mutexes. The load followed by swap added in 89b6a47 lets two updates read the same old value and overwrite each other, losing a send-closed or receive-closed bit. Use atomic OR to preserve concurrent updates and annotate the atomic field. No caller uses the previous value, so remove the helper result. Passing the zero-valued open state remains a no-op. Assisted-by: Codex
Contributor
Author
|
r? @nybidari Could you review the send-state snapshot race and concurrent close-direction updates? Focused local Bazel checks passed. Upstream checks have not reported yet. Assisted-by: Codex |
Contributor
Author
|
Closing in favor of consolidated #14338. The expanded replacement commits are prepared locally; the replacement branch has not been pushed yet. Assisted-by: Codex |
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.
Two TCP state paths use atomic storage without preserving its synchronization contract.
The send-buffer option callback atomically disables autotuning without the endpoint or send-queue mutex, but endpoint probes copy the flag with RacyLoad. The first commit uses atomic snapshot accesses, declares the flag and queue-lock contracts, and extends the endpoint-probe regression with a concurrent option callback. The unsynchronized snapshot dates to 96459f5 and was retained by ef9e8d9.
Readiness and shutdown also update connection-direction bits under different mutexes. The load-then-swap added in 89b6a47 can lose a concurrent send-closed or receive-closed update. The second commit uses atomic OR and declares the field's atomic contract; passing the zero-valued open state remains a no-op.
Assisted-by: Codex