[PR #1195] [MERGED] fix(ghidra): resolve secondary symbols at function entries #2708

Closed
opened 2026-10-17 21:09:19 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1195
Author: @N0zoM1z0
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/ghidra-entry-symbol-aliases


📝 Commits (2)

  • 3746446 fix(ghidra): resolve secondary symbols at function entries
  • e2718a6 test(ghidra): derive interior bytes from decoded instructions

📊 Changes

7 files changed (+193 additions, -4 deletions)

View changed files

📝 bridge/ghidra/ReaGhidraBridge.java (+13 -2)
📝 docs/native-investigation.md (+3 -0)
📝 scripts/lib/real-ghidra-boundaries.mjs (+28 -1)
➕ scripts/lib/real-ghidra-entry-aliases.mjs (+126 -0)
📝 src/ghidra/GhidraAnalysisProfile.ts (+1 -1)
📝 tests/conformance/ghidra/README.md (+3 -0)
➕ tests/conformance/ghidra/entry-aliases.c (+19 -0)

📄 Description

Ghidra can inventory secondary entry labels such as _main but rejects them as procedure selectors. Resolve exact entry symbols (leaf or qualified) to their function, counting each function once; keep explicit address precedence, ambiguity diagnostics, and interior-label rejection. Bump the location-resolution profile so retained results use the corrected semantics. Fixes #1170.

The real Ghidra lane now compiles a source-owned fixture and exercises imported aliases, a bare-hex alias, canonical names, addresses, pseudocode, function dossiers, annotation, CLI/MCP parity, interior-label refusal, and immutable source bytes.

Validation:

  • Independently reproduced on Linux x64 / Ghidra 12.1.4 / JDK 21 through CLI and MCP. The new real-provider regression fails on main before the fix and passes after it.
  • npm run build:cached and npm run check:fast passed.
  • Full real Ghidra host lane (node scripts/verify-real-ghidra.mjs, following the build) passed on the final head: CLI/MCP parity, aliases, annotation and snapshot lifecycle, large-result export, startup cancellation, and complete cleanup. The verifier also now derives an interior instruction byte from decoded instructions instead of assuming entry + 1 is inside an instruction.
  • All 22 CI checks passed on e2718a640dab1227e55ad7242cc07d620fb04bea.
  • The Mach-O fixture cross-compiles with Clang; native macOS Ghidra and real Hopper were not run.

No public schema or tool inventory change. The fix only selects existing functions and preserves ephemeral annotation authority.


🔄 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/1195 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/ghidra-entry-symbol-aliases` --- ### 📝 Commits (2) - [`3746446`](https://github.com/morluto/rea/commit/3746446706180fa51530b7ff700edcead618dc50) fix(ghidra): resolve secondary symbols at function entries - [`e2718a6`](https://github.com/morluto/rea/commit/e2718a640dab1227e55ad7242cc07d620fb04bea) test(ghidra): derive interior bytes from decoded instructions ### 📊 Changes **7 files changed** (+193 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `bridge/ghidra/ReaGhidraBridge.java` (+13 -2) 📝 `docs/native-investigation.md` (+3 -0) 📝 `scripts/lib/real-ghidra-boundaries.mjs` (+28 -1) ➕ `scripts/lib/real-ghidra-entry-aliases.mjs` (+126 -0) 📝 `src/ghidra/GhidraAnalysisProfile.ts` (+1 -1) 📝 `tests/conformance/ghidra/README.md` (+3 -0) ➕ `tests/conformance/ghidra/entry-aliases.c` (+19 -0) </details> ### 📄 Description Ghidra can inventory secondary entry labels such as `_main` but rejects them as procedure selectors. Resolve exact entry symbols (leaf or qualified) to their function, counting each function once; keep explicit address precedence, ambiguity diagnostics, and interior-label rejection. Bump the location-resolution profile so retained results use the corrected semantics. Fixes #1170. The real Ghidra lane now compiles a source-owned fixture and exercises imported aliases, a bare-hex alias, canonical names, addresses, pseudocode, function dossiers, annotation, CLI/MCP parity, interior-label refusal, and immutable source bytes. Validation: - Independently reproduced on Linux x64 / Ghidra 12.1.4 / JDK 21 through CLI and MCP. The new real-provider regression fails on main before the fix and passes after it. - `npm run build:cached` and `npm run check:fast` passed. - Full real Ghidra host lane (`node scripts/verify-real-ghidra.mjs`, following the build) passed on the final head: CLI/MCP parity, aliases, annotation and snapshot lifecycle, large-result export, startup cancellation, and complete cleanup. The verifier also now derives an interior instruction byte from decoded instructions instead of assuming entry + 1 is inside an instruction. - All 22 CI checks passed on `e2718a640dab1227e55ad7242cc07d620fb04bea`. - The Mach-O fixture cross-compiles with Clang; native macOS Ghidra and real Hopper were not run. No public schema or tool inventory change. The fix only selects existing functions and preserves ephemeral annotation authority. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:19 +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#2708
No description provided.