M168: Fault injection and hostile-endpoint testing for the socket transport - #18
Merged
Merged
Conversation
Copilot created this pull request from a session on behalf of
rickenator
July 5, 2026 04:16
View session
rickenator
marked this pull request as ready for review
July 5, 2026 04:24
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.
Implements Milestone 168: extend Phase 1's hostile-input testing tradition to the M162 out-of-process transport boundary. Queue-full, out-of-order/duplicate KV appends, DMA descriptor rejection, endpoint crash mid-decode, and malformed completions must all map to
att1_status_tcleanly, without UB.New fault-injection test suite
tests/test_aimu_endpoint_fault_injection.cexercises five scenarios against a realatt1-aimu-endpointdaemon process (plus one hostile mock daemon):SIGKILLbetween submit and poll)kv_key_bytes/kv_value_bytes/payload_bytesclaims)tools/att1-aimu-endpoint.cgains--cmd-ring-depth/--comp-ring-depthCLI overrides so queue-full doesn't require filling the 64-deep default ring.Two real defects found and fixed
Writing the crash-mid-decode and malformed-completion cases surfaced actual bugs, not just missing coverage:
src/aimu_endpoint_protocol.cused a plainwrite(); once the peer had crashed, that raisesSIGPIPE, whose default disposition terminates the client process instead of returningATT1_ERR_IO. Fixed by switching tosend(..., MSG_NOSIGNAL).client_kv_read(),client_kv_copy_range(), andclient_fabric_receive()insrc/aimu_endpoint_client.cclamped daemon-reported lengths only against the caller's own buffer capacity, not against the wire payload's actual capacity (ATT1_AIMU_ENDPOINT_MAX_PAYLOAD). A malformed response claiming an oversized length, combined with a sufficiently large caller buffer, could read past the localatt1_aimu_endpoint_responsestruct. All three now clamp against both bounds before anymemcpy, andclient_fabric_receive()'s reported byte count now always matches what was actually copied.Docs
docs/PHASE2_PLAN.md,docs/OPERATION_LOG.md, andcompiler/check_docs.pyupdated to reflect M168 complete / M169 active.