Skip to content

feat(ghidra): add atomic function annotation edits - #709

Merged
N0zoM1z0 merged 6 commits into
mainfrom
feat/ghidra-analysis-metadata
Oct 6, 2026
Merged

N0zoM1z0 merged 6 commits into
mainfrom
feat/ghidra-analysis-metadata

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Changes

Add annotate_native_function and CLI annotate-native-function: atomically edit one local function name and/or entry comments, verify readback, and return a refreshed complete function dossier inline. Existing boolean naming/comment proxies do not provide this atomic edit plus refreshed analysis outcome.

  • Omitted fields preserve metadata; empty comment text clears it. Ghidra maps regular/inline comments to PRE/EOL and uses USER_DEFINED names. Namespaces remain intact and readback uses the same qualified name as function inventories.
  • End GhidraScript's inherited outer transaction before the resident service, then own one transaction per edit. A late invalid name rolls back earlier comment writes and retains earlier successful edits.
  • Flush name/function/string inventories and decompiler caches after edits or rollback; declare mutation effects so immutable analysis snapshots cannot serve stale metadata.
  • Preserve executable bytes and body ranges. Edits live only in the ephemeral MCP session; CLI returns updated evidence before close. This does not save a project or alter ABI, types or instructions.
  • Bind handshake mutation authority to the transport and exact capability set. Windows P0 and Hopper do not admit this new operation.
  • Preserve the rejected function-name constraint and address in typed caller issues.
  • Regenerate canonical contracts/catalogs and update guides and README family counts.

Verification

Integrated origin/main ab5a1c61 before publication, including Windows native read-only authority 26881da7. Before merge, also tested a temporary conflict-free integration with latest main c3bc38bf (function comparison source parameters), with 70 tests across source and actual MCP boundaries passing; then restored the exact CI-tested PR head.

  • 107 focused tests across 10 files passed, covering Ghidra parsing/provider/handshake/transport, CLI catalog, canonical contracts and actual pinned-SDK MCP handlers.
  • Namespace/diagnostic follow-up: 25 focused source tests passed.
  • Latest Windows main integration: 80 affected tests across 9 files passed after updating the removed capability constant reference; the 5-test annotation file was rerun on its corrected source. Windows capability reporting keeps mutation unavailable even when its native controls are present; Windows real/package verifiers exclude the unadmitted mutation.
  • Initial CI exposed stale read-only capability/profile assertions and a packaged-bridge literal check. Updated them for transport-bound authority; the two failed tests and actual packaged-bridge/Hopper regex probe passed locally. DOS verifier profile assertions and MCP fixture authority were aligned as well.
  • Typecheck and lint passed; generated documents checked. Latest process Evidence main follow-up: 25 affected source tests passed; no Ghidra code changed in that follow-up.
  • Real Linux Ghidra 12.1.4, public COM fixture, actual npm artifact CLI/MCP: complete load-image/memory/mapping parity, metadata readback, late-failure transaction rollback, retained previous edits, fresh inventories/decompiler, comment clearing, unchanged input, and owned-process cleanup. Run 87b2e895-2072-4f22-bda9-a5793c695ee0. Artifact used the locked workspace dependencies; this is not a fresh dependency installation claim.
  • Public MZ far-return routine plus two private local analysis artifacts passed annotation/rollback/cache/body/byte checks and verified load-image checks; run dd5a90bd-b456-4c86-8e92-82f681d48aee. Private paths, executables, projects and outputs are excluded from the repository and package.
  • Real namespaced C++ routine CLI proof passed before publication; run 36adcb9c-3717-47f0-887a-338986f53126. Final publication artifact namespace/diagnostic follow-up passed with one CPU and bounded heaps; run 08c095c8-4fa0-46c9-a441-b6e953ae075a. It verified qualified-name readback, refreshed decompilation, precise invalid-name issues, unchanged source bytes, and no owned descendants. Windows-main publication artifact proof also passed: ca02e291-6fdc-4672-a7b2-9f5f300fe28a, with qualified rename, refreshed decompilation, precise invalid-name issues, unchanged source bytes and no owned descendants. The full COM artifact proof precedes this narrow namespace/diagnostic hardening; its transaction/cache code is unchanged.

Local work now runs sequentially on one CPU with lower priority, Node old-space capped at 768 MiB and Java heap at 512 MiB. The Go compiler has one runtime worker and a 768 MiB soft memory target; these are not total RSS limits. No host configuration changes.

No real macOS/Hopper verification performed for these changes. Windows mutation remains unavailable. No demo or game reconstruction is included.

Example

{"name":"annotate_native_function","arguments":{"procedure":"0x10100","name":"entry","comment":"Recovered startup role","inline_comment":"Inspect segment setup"}}
rea annotate-native-function /local/program.com 0x10100 --target-format dos-com --provider ghidra --name entry --comment 'Recovered startup role' --json

Both return annotation readback and the refreshed dossier inside normal Evidence. Analyst-authored names/comments do not establish original-source naming authority.

Return annotation readback and refreshed function analysis through CLI and MCP. Own each database transaction, invalidate caches and immutable snapshots, preserve executable bytes, and retain the Windows mutation boundary.

Assisted-by: Nitori (gensokyo-skills:nitori-reverse-engineering)
Preserve namespaces during local name writes and match qualified readback to the refreshed dossier. Add a producer-shaped regression and verify a real namespaced C++ function through the CLI.

Assisted-by: Nitori (gensokyo-skills:nitori-reverse-engineering)
Preserve Windows native inspection authority while excluding annotation mutation from capabilities, transport handshake, and provider verification. Update the platform boundary documentation.

Assisted-by: Nitori (gensokyo-skills:nitori-reverse-engineering)
Keep strict capability and profile checks while admitting the explicit session metadata operation. Verify packaged transport authority and atomic transaction commitments and preserve a read-only Windows expectation.

Assisted-by: Nitori (gensokyo-skills:nitori-reverse-engineering)
@N0zoM1z0
N0zoM1z0 merged commit 9bab553 into main Oct 6, 2026
19 checks passed
@N0zoM1z0
N0zoM1z0 deleted the feat/ghidra-analysis-metadata branch October 6, 2026 09:24
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
* feat(ghidra): edit function annotations atomically

Return annotation readback and refreshed function analysis through CLI and MCP. Own each database transaction, invalidate caches and immutable snapshots, preserve executable bytes, and retain the Windows mutation boundary.

Assisted-by: Nitori (gensokyo-skills:nitori-reverse-engineering)

* fix(ghidra): preserve qualified function annotation identity

Preserve namespaces during local name writes and match qualified readback to the refreshed dossier. Add a producer-shaped regression and verify a real namespaced C++ function through the CLI.

Assisted-by: Nitori (gensokyo-skills:nitori-reverse-engineering)

* test(ghidra): align verification with annotation authority

Keep strict capability and profile checks while admitting the explicit session metadata operation. Verify packaged transport authority and atomic transaction commitments and preserve a read-only Windows expectation.

Assisted-by: Nitori (gensokyo-skills:nitori-reverse-engineering)
@morluto morluto added enhancement New feature or request area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added the provider: ghidra Analysis provider / engine: ghidra label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants