fix(simulator): improve grouped signal handling and runtime reliability - #12
Open
matthewrossi wants to merge 5 commits into
Open
fix(simulator): improve grouped signal handling and runtime reliability#12matthewrossi wants to merge 5 commits into
matthewrossi wants to merge 5 commits into
Conversation
matthewrossi
commented
Sep 3, 2026
Collaborator
- Scope uprobes to the target model process and pin ptrace setup to a single OS thread.
- Support up to 16 signals in grouped reads, writes, and live perturbations.
- Correct group-cookie encoding and write-trajectory indexing.
- Configure eBPF signal-map capacities before loading the maps.
- Prevent monitoring hangs when ring-buffer records are lost or the model exits early.
- Improve process cleanup and monitoring error propagation.
Start the model before attaching its uprobes and keep it stopped while runtime addresses are resolved and installed. Attach read, write, and timer probes using the target PID, then detach from ptrace. This prevents other instances of the same executable from triggering probes configured with process-specific runtime addresses.
Lock the simulator goroutine to its OS thread before starting the ptraced model and keep it pinned through address resolution, uprobe attachment, and detachment. Release the thread immediately after ptrace synchronization completes and ensure early error paths also unlock it.
Encode group sizes as size minus one to support 1–16 signals with the four-bit uprobe cookie field. Reject empty groups and configurations with more than 16 read or write signals. Expand eBPF and userspace injection buffers and loops to handle 16 signals consistently. Split write processing into unrolled eight-entry chunks to avoid verifier failures, and correct live perturbation trajectory indexing when read signals precede writes.
Terminate the model once the configured cycle limit is reached even if the final ring-buffer reservation fails, and retry termination after the cycle counter advances beyond the limit. Track and reap the model process during monitoring, use userspace cancellation as a termination fallback, and report incomplete traces instead of waiting indefinitely for missing records. Also propagate monitoring errors correctly in perturbation modes.
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.