Skip to content

fix(ghidra): bind existing MIPS projects to target metadata - #8605

Merged
morluto merged 2 commits into
mainfrom
codex/ghidra-existing-mips-profile
Nov 4, 2026
Merged

morluto merged 2 commits into
mainfrom
codex/ghidra-existing-mips-profile

Conversation

@morluto

@morluto morluto commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #8225. Selecting an ordinary header-selected MIPS ELF project succeeded at open_binary, but the first query failed because its existing-project profile did not contain the fresh-import MIPS lane required by client admission. Bind the selected target's MIPS ELF metadata into the existing-project profile and validate that metadata without claiming REA performed the project's original import.

Contract and scope

The existing profile and MIPS admission owners keep the project fingerprint, exact program selection and target-derived ELF facts. An existing project remains read-only, with unknown original analysis settings and completeness; no fresh-import lane is asserted. Fresh-import lane validation is unchanged. A different saved program is still rejected by the bridge's imported-byte digest check. This covers already admitted POSIX, header-selected targets; it does not widen pinned, PSP, soft-float, raw, or Windows existing-project admission.

The added target metadata changes the profile digest for existing MIPS projects, so earlier snapshots of those projects cannot be replayed under this profile. No executable is run or modified.

Evidence and validation

  • On the original base, real Ghidra 12.1.4 sessions for saved big- and little-endian MIPS projects failed on their first query with the mismatched-lane diagnostic. On this change, full and compact stdio MCP listed procedures and inspected caller-authored types from both projects. The observed offsets were big-endian 5/0 and little-endian 0/3; profile records retained the project selection, corresponding target byte order, and unknown original settings/completeness. Original project files and target bytes stayed unchanged.
  • Selecting the little-endian target with the big-endian project was refused by Ghidra's imported-byte digest check before the bridge became ready. A focused profile test checks that different or missing target metadata is rejected and a fresh-import profile still requires its lane.
  • npm run verify:ghidra:mips passed on macOS arm64 with Ghidra 12.1.4/JDK 21, Homebrew LLVM 23 and temporary GNU readelf 2.47. The six-fixture report includes new source-built existing-project controls for both byte orders, unchanged source project/target checks, verified process lineage and no remaining descendants. The full lane's other existing fresh-import, legacy and soft-float checks also passed.
  • npm run test:focused -- src/ghidra/GhidraMipsProfile.test.ts src/ghidra/GhidraProvider.behavior.test.ts — 269 passed. npm run check:fast, npm run docs:check, and git diff --check passed.
  • The existing-project verifier creates its own project through headless Ghidra and tests the public stdio MCP workflow; the earlier base reproduction used independently created projects. No Windows or non-macOS real-provider run is claimed.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Combined saved-project control: in a temporary checkout of #8605 f49c5f4fc with #8602 00e823b9c applied, real Ghidra 12.1.4 full and compact stdio MCP inspected the caller-authored bit fields in both original MIPS projects. Big-endian offsets were 5/0, little-endian offsets 0/3, each /uint base was inspectable, the profiles preserved target byte order and unknown original analysis settings, and original project/target hashes were unchanged. A different target with the selected project was refused by the imported-byte digest check. The combined tree passed 96 focused MIPS/profile/snapshot tests and check:fast. This verifies a local combination; neither PR includes the other.

The same temporary combination also passed the complete npm run verify:ghidra:mips lane: all six fixtures passed, including both saved-project controls, with unchanged source project and target hashes, verified process lineage, and no remaining descendants. This is a combined result, not a claim that either PR contains the other.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects were found.

Summary

The PR binds saved MIPS projects to the selected target’s ELF metadata without claiming that REA performed their original import.

  • Saved MIPS projects match their target’s ELF metadata before queries.

Review scope: the previous and current commits have different merge bases, so this review covered the full PR diff. No previous review threads were supplied. git diff --check passed; runtime tests were not run. A check for superseding PRs was blocked by missing GitHub authentication.

Reviews (2) · Last reviewed commit: "merge: integrate main into existing MIPS..." · Reviewed by Greptile

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-04T19:12:42.375187Z
We couldn’t complete this review. Comment @codex review to try again.
972bc16 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Bring the branch up to date so static checks and the verifier fixture
match the current module layout.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 982e750 into main Nov 4, 2026
49 checks passed
@morluto
morluto deleted the codex/ghidra-existing-mips-profile branch November 4, 2026 19:35

@jy9y4wds8z-alt jy9y4wds8z-alt left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

****

@morluto morluto added bug Something isn't working provider: ghidra Analysis provider / engine: ghidra labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Existing MIPS Ghidra projects fail with a misleading profile mismatch

3 participants