Repository navigation
feat(ghidra)!: identify containing code and data - #8777
Merged
Merged
Conversation
Contributor
[Medium impact] The reviewed changes appear safe to merge; no actionable new issue was found. Summary
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Selected address] --> B[Ghidra Listing lookup]
B --> C[Exact instruction]
B --> D[Containing instruction]
B --> E[Containing defined data]
C --> F[Provider result checks]
D --> F
E --> F
F --> G[Evidence preserves selected address]
E --> H[Starting address]
H --> I[inspect_native_data_type]
Reviews (9) · Last reviewed commit: "chore: integrate current main" · Reviewed by Greptile |
morluto
marked this pull request as ready for review
November 4, 2026 16:53
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
morluto
enabled auto-merge (squash)
November 7, 2026 18:18
Entrpi
added a commit
to Entrpi/rea
that referenced
this pull request
Nov 8, 2026
targetDiagnostics.test.ts: main checks the load remediation's arguments by pattern instead of a frozen sentence; check the branch's added arguments the same way with stating(). Main's instruction-status (morluto#8777), byte-search coverage (morluto#8608) and value-flow (morluto#8651) revisions change every Ghidra raw profile digest. The legacy pins take the digests main computes at 5044e20 for the same loads, the M-profile pin is recomputed, and rawLoadCompatibility.test.ts sets aside the new revisions.
3 tasks done
Entrpi
added a commit
to Entrpi/rea
that referenced
this pull request
Nov 8, 2026
Main's instruction-status (morluto#8777), byte-search coverage (morluto#8608) and value-flow (morluto#8651) revisions change every Ghidra profile. Control: with main's GhidraAnalysisProfile.ts changes since 99db80a reversed, the old pins hold (169 of 171; the other two assert the new parameters).
3 tasks done
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.
Summary
A byte-search hit inside a Ghidra-listed instruction or defined data object did not identify its containing object. The function-listing workaround fails when there is no containing function, and exact type inspection cannot locate an unknown parent.
inspect_native_instructionnow preserves the selected address and separately returns the Ghidra Listing's containing instruction or defined data identity. A data object's start can be passed toinspect_native_data_type; no field or union member is selected. The Ghidra adapter checks status, address space and extent before accepting the observation. CLI and MCP descriptions expose the handoff; CLI help also retains the typed incoming-reference guidance from #8514. Addresses #8241 and #8240.These are provider listing observations, not proof of source layout, runtime execution, or an alternate decode. Type paths may not all be independently resolvable; the defined-object start is the exact-address handoff. Other providers and older Evidence may omit the new fields.
Snapshot compatibility
The Ghidra analysis profile changes once for both code and data observations. Older Ghidra snapshots fail with
evidence_integrity_mismatch; open the target without the old snapshot and save a fresh one. This profile-wide break affects snapshots even when they contain no instruction query. Historical Evidence remains importable without either field.Validation
Follow-up: hosted source tests found two simulated Ghidra
datafixtures omitted the containing-data object now required by the bridge contract. The fixtures now supply a one-byte defined object at the queried address; no production validation was relaxed. All six focused instruction-reference facet tests pass on Node 24.22.1. Merged mainc928bb8without conflict and re-ran those six tests; no real Ghidra was run for this follow-up.Follow-up: merged main
ac30fbd, including the style(test): format CLI help default annotations #9280 CLI-help formatting fix; Node 24npm run format:checkpasses. The focused tests below ran before this formatting-only main follow-up.Reconciled with main
2e2f981: retained both containing-listing scope and current paged incoming-reference guidance, combined snapshot commitments and refreshed their raw-profile goldens. On Node 24.22.1, four focused Ghidra profile/snapshot and MCP-boundary suites passed 146 tests;check:fast,docs:check, and diff checks passed. The MCP tests use a simulated provider; live Ghidra was not rerun after reconciliation. Hosted checks must run on the updated head.CI follow-up: the source and portable lanes failed their tool-effects wording check on “data object start.” The description now says “starting address.” The affected test (8 tests),
check:ci:fast, anddocs:checkpassed locally; the new CI run remains pending.Real public MCP byte-search workflow on an x86-64 PE: a match at
0x180001002remained the selected address and identified the containingMOVat0x180001001. Instruction starts, defined data and outside-memory cases were also checked; the target digest stayed unchanged.Real Ghidra 12.1.4/macOS arm64, full and compact MCP: an AArch64 overlay without a containing function returned its space-qualified instruction start and length. A separate selected project returned
not-in-listingfor both uninitialized and initialized-but-unlisted memory. These were disposable projects; targets were unchanged.Real Ghidra non-ASCII overlay control in both MCP profiles: a project-authored
REA_Ω_DATAaddress space round-tripped asREA_%CE%A9_DATA, preserving the selected interior address, parent identity and exact type lookup. The default-space instruction at the same offset stayed distinct; all ten selected-project file digests and the target digest were unchanged.Real Ghidra selected-project overlay control in both MCP profiles: the overlay-qualified data address resolved to its parent and exact type layout, while the same default-space offset resolved to an instruction. All ten source-project regular-file digests and the target digest were unchanged.
Real Ghidra selected project with a caller-authored union: a byte-search hit inside the structure returned the parent address and type; the existing type tool returned both overlapping union members. Object start, interior, last byte, outside address and CLI inspection were checked. Project-authored bytes are not claimed as target-file bytes.
Real Ghidra padding control in both MCP profiles: an interior byte of a project-authored eight-byte structure resolved to the parent; named fields at offsets 0 and 4 did not cover the selected padding byte. No field was inferred and the executable digest remained unchanged.
Real Ghidra bit-field control in both MCP profiles: the selected byte resolved to its containing structure; the existing type tool returned both project-authored bit fields at that byte, with their distinct bit sizes and offsets. No field was selected, and the executable digest remained unchanged.
Real Ghidra array control in both MCP profiles: an interior byte returned its 12-byte parent; exact type inspection by parent address and by its
/dword[3]type path reported three elements with a four-byte stride. The target was unchanged. This is one array type, not a general guarantee that all type paths resolve.Real Ghidra dynamic-string control in both MCP profiles: the containing object reported length 11 while exact type inspection reported a null fixed size. The output schema now explicitly distinguishes object length from dynamic type size; the target digest was unchanged.
Snapshot control on the final profile: old snapshot refused unchanged; a fresh snapshot saved and replayed the instruction observation. A pre-change Evidence bundle imported and re-exported with the historical record and ID unchanged. Target and original bundle digests were unchanged.
Ghidra headless address-unit control: a synthetic two-byte addressable-word space returned byte offset 6 for word offset 3; the bridge serializes that offset and Ghidra documents instruction length in bytes. This is not a real word-addressed-program test.
npm run test:focused -- tests/boundary/mcp/ghidraContainingListingMcp.test.ts tests/boundary/mcp/ghidraCompactReferencesMcp.test.ts src/ghidra/GhidraFunctionValues.test.ts src/ghidra/GhidraRawProfileDigest.test.ts tests/boundary/mcp/toolSchemaValidity.test.ts— 141 passed. Controls include missing, unexpected, wrong-space, invalid and out-of-range containment.After review fixes,
npm run test:focused -- src/ghidra/GhidraSnapshotCache.test.ts tests/boundary/mcp/ghidraContainingListingMcp.test.ts— 33 passed. The snapshot test now checks the final revision against previous and absent values; negative controls use valid coordinates and assert the provider-output error, so the status check cannot be masked by a coordinate failure.npm run check:ci:fastandnpm run docs:check— passed after the schema-description update. The fast check and live CLI help were also verified after the incoming-reference wording change. The 30 focused MCP and schema tests passed, and the live full MCP output schema contains the dynamic-size clarification.Other Ghidra versions, Windows/Linux, alternate instruction modes, live Ghidra listings over subsequently uninitialized memory, and real Hopper/IDA/Kuna instruction providers were not exercised. The union control covers one caller-authored layout, not arbitrary recursive or bit-field layouts.
Current main refresh
Merged main at
a67525cdf1; the Ghidra provider behavior fixture suite passed (269 tests). No additional real Ghidra run was performed.Main refresh for inventory profiles
Merged main at
f912a68417; retained containing-instruction CLI wording and both instruction-status and inventory-search profile facts, and refreshed the raw profile digest expectations. Ghidra provider fixture, raw profile, and snapshot cache suites passed (295 tests). No additional real Ghidra run was performed.Author readiness
Human owner: