[PR #1652] [CLOSED] fix(ghidra): reject occupied compact address names #4727

Closed
opened 2026-10-31 00:54:26 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1652
Author: @N0zoM1z0
Created: 10/10/2026
Status: ❌ Closed

Base: main ← Head: fix/1649-ghidra-duplicate-names


📝 Commits (2)

  • 75881af fix(ghidra): reject names owned by another address
  • 8005cad fix(ghidra): preserve explicit annotation naming semantics

📊 Changes

5 files changed (+178 additions, -23 deletions)

View changed files

📝 bridge/ghidra/ReaGhidraBridge.java (+21 -11)
📝 docs/native-investigation.md (+5 -2)
📝 scripts/lib/real-ghidra-namespace-annotations.mjs (+140 -7)
📝 src/ghidra/GhidraProviderCapabilities.ts (+2 -2)
📝 tests/conformance/ghidra/namespaces.c (+10 -1)

📄 Description

Ghidra permits duplicate names within a namespace, so set_address_name previously returned true when another function or label already owned the requested name. Reject that collision before mutation, after resolving the leaf within the existing namespace. The shared path covers compact single and batch naming.

Same-address replay and identical leaves in separate namespaces remain supported. Each batch entry retains its own transaction, and a rejected edit preserves the previous name and comments. Explicit function annotations retain their existing native naming semantics and exact-address ambiguity diagnostics. Update provider guidance and the real namespace fixture to cover function/label collisions, qualified names, partial batches, and reuse after release.

Closes #1649.

Validation:

  • Real Linux REA stdio MCP with Ghidra 12.1.4/JDK 21 reproduced the original duplicate-function and duplicate-label successes before the fix.
  • Corrected real MCP boundary controls reject collisions, preserve old names, and allow replay; additional interior-label and external-symbol controls pass. A real CLI annotation control confirms existing native annotation behavior.
  • npm run build:cached and npm run check:ci pass (8 tasks and architecture guards).
  • npm run verify:ghidra passes on the final head: public CLI/stdIO MCP, namespace naming regressions, existing annotation ambiguity, snapshot/lifecycle, unchanged target bytes, and verified empty owned-process lineage.
  • npm run docs:check passes.

Real Linux Ghidra verification was performed. Native macOS/Windows and real Hopper/IDA were not locally verified; Windows P0 remains read-only. These edits affect ephemeral analysis metadata and leave executable bytes unchanged.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1652 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/10/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/1649-ghidra-duplicate-names` --- ### 📝 Commits (2) - [`75881af`](https://github.com/morluto/rea/commit/75881af7aaaaa5564fac3d9c89325244fc40ea83) fix(ghidra): reject names owned by another address - [`8005cad`](https://github.com/morluto/rea/commit/8005cad3741c209a6b1ca1d570692450b5bd1a8b) fix(ghidra): preserve explicit annotation naming semantics ### 📊 Changes **5 files changed** (+178 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `bridge/ghidra/ReaGhidraBridge.java` (+21 -11) 📝 `docs/native-investigation.md` (+5 -2) 📝 `scripts/lib/real-ghidra-namespace-annotations.mjs` (+140 -7) 📝 `src/ghidra/GhidraProviderCapabilities.ts` (+2 -2) 📝 `tests/conformance/ghidra/namespaces.c` (+10 -1) </details> ### 📄 Description Ghidra permits duplicate names within a namespace, so `set_address_name` previously returned `true` when another function or label already owned the requested name. Reject that collision before mutation, after resolving the leaf within the existing namespace. The shared path covers compact single and batch naming. Same-address replay and identical leaves in separate namespaces remain supported. Each batch entry retains its own transaction, and a rejected edit preserves the previous name and comments. Explicit function annotations retain their existing native naming semantics and exact-address ambiguity diagnostics. Update provider guidance and the real namespace fixture to cover function/label collisions, qualified names, partial batches, and reuse after release. Closes #1649. Validation: - Real Linux REA stdio MCP with Ghidra 12.1.4/JDK 21 reproduced the original duplicate-function and duplicate-label successes before the fix. - Corrected real MCP boundary controls reject collisions, preserve old names, and allow replay; additional interior-label and external-symbol controls pass. A real CLI annotation control confirms existing native annotation behavior. - `npm run build:cached` and `npm run check:ci` pass (8 tasks and architecture guards). - `npm run verify:ghidra` passes on the final head: public CLI/stdIO MCP, namespace naming regressions, existing annotation ambiguity, snapshot/lifecycle, unchanged target bytes, and verified empty owned-process lineage. - `npm run docs:check` passes. Real Linux Ghidra verification was performed. Native macOS/Windows and real Hopper/IDA were not locally verified; Windows P0 remains read-only. These edits affect ephemeral analysis metadata and leave executable bytes unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:54:26 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#4727
No description provided.