Skip to content

checklocks: clarify futex bucket contracts - #14298

Closed
tamird wants to merge 2 commits into
google:masterfrom
tamird:checklocks-futex-pi
Closed

checklocks: clarify futex bucket contracts#14298
tamird wants to merge 2 commits into
google:masterfrom
tamird:checklocks-futex-pi

Conversation

@tamird

@tamird tamird commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

The PI lock and unlock helpers operate on a bucket acquired by their callers. Declare those entry requirements without changing lock scope.

Correct the ordered bucket return contract: the first handle is always non-nil, and the second is nil only when both keys select the same bucket. Retain prose for these conditional aliases that checklocks cannot express.

Include PI waits in waiter lifecycle documentation and state the membership and lock requirements for wake and requeue helpers. Preserve the lock-and-revalidate protocol and reverse-order release.

Assisted-by: Codex

@tamird

tamird commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

r? @EtiennePerot Could you review PI helper lock requirements and conditional bucket aliases?

Focused local Bazel checks passed. Upstream checks have not reported yet.

Assisted-by: Codex

tamird added 2 commits August 22, 2026 09:23
Recognize atomicbitops Racy methods as non-atomic operations. Permit
mixed-mode RacyLoad only when all guards are held, and require atomic
writes with all guards held exclusively. Distinguish shared-lock reads
from lock-free atomic reads so an RLock cannot authorize writes.

Check atomic uses of annotated globals at the consuming instruction
instead of discarding that instruction. Keep unannotated-global behavior
unchanged, preserve function and closure ignores, and distinguish writes
to a global from stores of its address.

Resolve generic instantiations to their original declarations before
classifying atomic operations. This recognizes atomic.Pointer methods
without bypassing package or mixed-access checks for generic calls.

Assisted-by: Codex
Use atomic.Pointer for the waiter's bucket pointer and require atomic
accesses. The generated wrapper only delegates to the same pointer
operations, but hides them behind a package the checker does not
classify as atomic. Waiters are not serialized, so its generated state
hooks are unnecessary.

Declare the PI lock and unlock helpers' existing bucket requirements.
Preserve the ordered lock handles and explain why logical bucket aliases
and moving waiter membership cannot carry uniform mutex annotations.

Document that a queued waiter cannot be reused until WaitComplete
returns. Keep the lock-and-revalidate protocol, atomic nil publication
after notification and reverse-order bucket release.

Assisted-by: Codex
@tamird
tamird force-pushed the checklocks-futex-pi branch from 0408003 to 583330f Compare August 22, 2026 16:19
@tamird

tamird commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of consolidated #14345. The expanded replacement commits are prepared locally; the replacement branch has not been pushed yet.

Assisted-by: Codex

@tamird tamird closed this Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant