Skip to content

feat(ghidra): apply validated analyzer overrides before analysis - #1913

Merged
N0zoM1z0 merged 8 commits into
mainfrom
review/ghidra-analyzer-overrides-1800-20261011
Oct 11, 2026
Merged

N0zoM1z0 merged 8 commits into
mainfrom
review/ghidra-analyzer-overrides-1800-20261011

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Configured Ghidra analyzer opt-outs now apply before analysis and bind to the same provider profile. This adopts @akushonkamen’s implementation from #1800 with validated corrections. Every requested registered name is checked before any option changes; disabled values are read back, and rejection aborts headless analysis before bridge readiness. Raw and header-based imports share this commitment.

A real six-byte raw repro also exposed unsupported x86 compiler specs. x86/x86_64 now use supported gcc specs consistently in profile, launch and independent load-image verification. These specs select analysis conventions; they do not identify the original compiler or ABI. Existing real seed/raw verifiers cover analyzer readback, mixed known/unknown-name rejection, byte controls and lifecycle behavior.

Validation:

  • All 31 exact-head CI checks passed, including CI required, static checks, the native Windows lane and both Apple lanes. Integration with main perf(ghidra): compile bundle activator with bridge scripts #1931 and fix(session): verify retained client liveness on open fast path #1776 had no conflicts. A fresh runtime/skill build of the exact tree merged as 9878bb72 and six focused files passed: 93 tests, one platform-specific skip. No new full local typecheck is claimed.
  • Real Linux Ghidra 12.1.4: the original ignored-name bug reproduced through public MCP; corrected unknown names reject before analysis/bridge. Real seed/analyzer readback and mixed-name controls passed. ARM CLI/MCP canonical-entry reuse/replacement and x86/x86_64 imports, mapping, byte readback and decompilation passed with unchanged targets and no owned descendants. Separate six-byte public MCP runs with overrides passed on integrated head e0fda688.
  • Post-merge native Windows Ghidra 12.1.4, exact 9878bb72: 16 public MCP checks on a 1,536-byte PE passed with WindowsResourceReference, return 42, call edge, mapped bytes, failed-query recovery, P0 mutation denial and unchanged target bytes. Repeated open retained the run ID and actual native observation showed no analysis JVM before the first query. The analysis JVM’s override preScript, requested name and -Xmx256M were observed. Close, closed-session status, ping, empty private TEMP and native Job settlement all passed (exit 0, zero active processes).
  • Native Windows unknown-name control on integrated head e0fda688: public execution_failure, ping, close, closed-session status, unchanged target and empty TEMP passed before bridge readiness.

Scope: Windows raw remains unsupported. Windows workflows used a private 280-second SDK first-query budget; default-deadline success and the reported Objective-C Mach-O performance remain unverified. These runs do not establish a timing improvement. The native run stayed within its 1.75 GiB Job commit limit. Original contributor commits are retained in the PR branch; GitHub recognizes the original contributor and maintenance coauthors in the merged commit.

Refs #1783, #1836. Follow-up to #1800 and #1868.

akushonkamen and others added 7 commits October 11, 2026 19:14
…ALYZERS

Default auto-analysis can stall in a single analyzer, such as
ObjcMessageAnalyzer on a Swift/Objective-C arm64 Mach-O, and a caller
had no way around it: the headless launcher passed -preScript only for
DOS COM preparation and seed files, and the analysis profile always
recorded analyzer_preset "ghidra-default" (#1783).

REA_GHIDRA_DISABLED_ANALYZERS now names comma-separated Ghidra
auto-analyzers that a pre-analysis script disables before default
auto-analysis, following the same packaged pre-script precedent. The
analysis profile records the override in analyzer_preset and
analysis_options, and a session refuses to open when its committed
profile and the setting differ, so snapshots and Evidence stay bound
to the analysis that actually ran.

Validation: new tests for the setting parser, launcher argv injection
and ordering, and profile recording plus fail-closed profile binding;
existing launcher, DOS COM, seeds, language-override, and Ghidra MCP
evidence coverage rerun green (314 src/ghidra module tests, 54 ghidra
boundary tests, check:fast, verify:test-discovery, generated-file
checks). Real Ghidra was not exercised: this machine has no Ghidra
installation; the stall reproduction and the disable-one-analyzer
control come from the issue report's out-of-repo analyzeHeadless runs
on Ghidra 12.1.4.
…ndows verifier

The caller-cwd shadowing verifier enumerated exactly the bridge scripts
the launcher passes as arguments, but missed the new
ReaGhidraAnalysisOptions.java preScript, leaving the new script outside
the shadowing coverage and the caller-cwd preservation assertion.

Sorting the list is required, not cosmetic: the assertion compares
readdir(callerDirectory).sort() against it, so the pre-sort order
introduced in 162f9bf and af88184 could never match on any platform
(reproduced with a local readdir+sort probe; the lane itself requires a
Windows x64 host and was not run here). Also documents the 120-character
single-name limit next to the 32-name cap in the installation guide.
Preserve the contributor implementation and both Hopper and Ghidra startup settings after the shared timeout parser rename.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Check exact analyzer registration and read back disabled options. Use HeadlessScript so an unknown or ineffective override aborts before auto-analysis and bridge startup instead of leaving a misleading successful profile.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Reuse the owned headless seed-regression lane to read back a disabled option and ensure a mixed known/unknown name list aborts before the post-script. Preserve seed controls and retry ownership when process cleanup fails.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Pin main 23d50ea for analyzer override verification. Preserve both packaged COM/raw script collision controls alongside the options script.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Commit analyzer overrides for both raw and header-based imports. Select registered gcc compiler specs for raw x86/x86_64 and validate actual mappings, byte readback and decompilation in the existing real-provider verifier.

Refs: #1836, #1783
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Reuse the independently merged tool wording audit and corrected managed fixture contract for the Ghidra adoption integration.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
@N0zoM1z0
N0zoM1z0 marked this pull request as ready for review October 11, 2026 18:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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 ✅ Completed 2026-10-11T18:18:17.634301Z e0fda68 Draft marked ready
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0fda68872

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +38 to +40
.refine(
(names) => names.every((name) => ghidraAnalyzerNamePattern.test(name)),
"must be Ghidra analyzer names starting with a letter or digit and containing only letters, digits, spaces, periods, underscores, and hyphens",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow valid analyzer-name characters

When an installed Ghidra analyzer has an exact registered name containing +, parentheses, a colon, or non-ASCII text, parseConfig rejects REA_GHIDRA_DISABLED_ANALYZERS before Ghidra can validate the name. These characters are valid in Ghidra analyzer names, and several are already safe in both direct argv and quoteWindowsBatchToken; the restrictive ASCII allowlist therefore prevents disabling otherwise valid built-in or extension analyzers. Reject only characters required by the comma encoding or launcher protocol rather than this narrower set.

AGENTS.md reference: AGENTS.md:L42-L42

Useful? React with 👍 / 👎.

@N0zoM1z0
N0zoM1z0 merged commit 9878bb7 into main Oct 11, 2026
31 checks passed
@N0zoM1z0
N0zoM1z0 deleted the review/ghidra-analyzer-overrides-1800-20261011 branch October 11, 2026 19:49
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@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
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants