Repository navigation
🐛 fix(soft-rw): verify holder before refresh - #982
Merged
Merged
Conversation
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.
OsFiles.overwrite()trusted a device and inode pair after the holder-record descriptor had closed. On a filesystem that reuses the inode, another file could pass that check and receive the holder's heartbeat bytes. The refresh now verifies the record's token on the descriptor it will write, and reports the hold lost when the bytes differ. This addresses draft advisory ANT-2026-CC0VMGLC.The inode could name a new file
The old identity and link-count check did not distinguish a later file that inherited a removed record's inode number. The new check reads the stable token prefix, accepting short reads until it has the full prefix, and writes only if it matches. Reading and writing through one descriptor keeps a name change between those operations from redirecting the write.
sequenceDiagram participant H as Holder participant F as Filesystem H->>F: Create record and close descriptor F-->>H: Device and inode identity Note over F: Record removed, later file reuses inode rect rgb(255, 214, 214) H->>+F: Old refresh checks identity and link count F-->>-H: Later file receives record bytes end rect rgb(216, 243, 220) H->>+F: New refresh also checks token prefix F-->>-H: Different bytes, no write endBehavior changes
SoftReadWriteLockandAsyncSoftReadWriteLockreport an evicted hold when the record path has the expected inode but lacks that participant's token. A holder record with its original prefix continues to refresh, including when its filesystem returns a short read. The check does not make a lock tree safe when another account can replace its directory; the directory boundary still applies.Reported by OSS Scanner: ANT-2026-CC0VMGLC.