Do signal-aware waits and meta snapshot#5
Merged
Merged
Conversation
dnsfs_query_record no longer re-waits uninterruptibly after a signal wakes wait_for_completion_interruptible. A signaled foreground waiter now returns -ERESTARTSYS at once, drops its reference, and reads no req fields (the worker may still be writing them). Safe by the existing refcount contract: the worker holds its own reference until after complete_all, so the shared coalesced request stays queued, still resolves, fills the cache, and wakes the other waiters; the last reference drop frees it. Adds test_signal_interrupt: a 3s-delayed resolver, SIGINT a cat once the wire query is observed, expect it to die within 1s. dnsfs_storage_assemble_once and dnsfs_storage_read_range_once snapshot storage->meta and storage->epoch into locals before sizing buffers. The read path runs without storage->lock, so a concurrent re-pin could grow chunk_count or size between the allocation and the loop bound, a heap OOB write; the snapshot closes it. A torn generation is caught by epoch/CRC and retried. dnsfs_query_tcp loops kernel_sendmsg until the whole framed query is sent (TCP is a byte stream) and fails a zero-length send; dnsfs_query_udp_once requires the datagram send to report the ful length.
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.
dnsfs_query_record no longer re-waits uninterruptibly after a signal wakes wait_for_completion_interruptible. A signaled foreground waiter now returns -ERESTARTSYS at once, drops its reference, and reads no req fields (the worker may still be writing them). Safe by the existing refcount contract: the worker holds its own reference until after complete_all, so the shared coalesced request stays queued, still resolves, fills the cache, and wakes the other waiters; the last reference drop frees it. Adds test_signal_interrupt: a 3s-delayed resolver, SIGINT a cat once the wire query is observed, expect it to die within 1s.
dnsfs_storage_assemble_once and dnsfs_storage_read_range_once snapshot storage->meta and storage->epoch into locals before sizing buffers. The read path runs without storage->lock, so a concurrent re-pin could grow chunk_count or size between the allocation and the loop bound, a heap OOB write; the snapshot closes it. A torn generation is caught by epoch/CRC and retried.
dnsfs_query_tcp loops kernel_sendmsg until the whole framed query is sent (TCP is a byte stream) and fails a zero-length send; dnsfs_query_udp_once requires the datagram send to report the ful length.
Summary by cubic
Make DNS queries signal-aware and harden send/read paths. Interrupted reads return fast, storage reads snapshot metadata to avoid races, and TCP/UDP sends ensure full writes.
Written for commit dd43a09. Summary will update on new commits.