Skip to content

fix(ghidra): respect Java Unix socket path limits - #8382

Merged
morluto merged 4 commits into
mainfrom
codex/ghidra-java-socket-boundary
Nov 7, 2026
Merged

morluto merged 4 commits into
mainfrom
codex/ghidra-java-socket-boundary

Conversation

@morluto

@morluto morluto commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

Ghidra startup fails on macOS when REA's proposed Unix-socket path is exactly 103 UTF-8 bytes. Select the existing short private socket root at the OpenJDK boundary, so the same analysis works at that length. Fixes #8378.

Problem and expected behavior

On a real Ghidra 12.1.4 / JDK 21 run, 102-byte socket paths succeeded, 103-byte paths failed with Unix domain path too long, and 104-byte paths succeeded because REA selected its short-root fallback. The CLI and MCP both hit the failure before analysis.

Change and scope

OpenJDK's Unix NIO implementation allows sizeof(sun_path) - 2 bytes. Use 102 on macOS and 106 on Linux before selecting the already-owned short socket root. Keep byte-based measurement and existing private-root lifecycle. The runtime observation is macOS-only; the Linux limit is source-derived and still needs a real Linux Ghidra run.

Contract and boundary impact

  • Semantic owner: the Ghidra transport endpoint allocator; no downstream reinterpretation or new configuration.
  • CLI/MCP and providers: affected Ghidra startups use the existing fallback; output schemas and analysis operations are unchanged. Windows loopback transport is unchanged.
  • Evidence, target, lifecycle: no change to target selection or Evidence. The fallback root remains private and owned until cleanup succeeds.
  • Generated metadata and installation: unchanged.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • A new real-provider CLI/MCP regression checks paths immediately below, at and above the Java limit, including a multibyte path. On macOS it observed 102 bytes in the normal runtime root and 103/104 bytes in the private short root; the 103-byte Unicode path also used the short root. The fallback directory had mode 0700, both runtime and socket roots were removed, and the source target hash was unchanged.
  • The same regression fails against the pre-change REA implementation at the 103-byte MCP request. Independent Java NIO controls accepted 100–102 bytes and rejected 103–104 on this host. The target was not executed.
  • The existing socket-root cleanup-failure and retry boundary test passed. The new real-provider test is included in the host-native Ghidra lane and defines corresponding Linux cases; these have not yet run on Linux.

Validation performed

Compatibility, safety, and release

  • No migration or compatibility shim. One extra byte of proposed path now selects the existing private fallback rather than a Java-rejected endpoint.
  • Real-provider coverage: macOS arm64, Ghidra 12.1.4 and Homebrew JDK 21.0.12.1. Linux values follow the cited OpenJDK source and standard sun_path size but remain runtime-unverified; other JDKs and Ghidra versions were not tested.
  • No target execution, target mutation, new transport or installation changes.

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.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

Lowers the Ghidra Unix-socket path limit to 102 UTF-8 bytes on macOS and 106 on Linux, matching the stated OpenJDK boundary.

  • Ghidra moves Unix socket paths over Java's limit into the private short root.

Reviews (4) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

@morluto
morluto marked this pull request as ready for review November 1, 2026 03:55
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T15:11:36.273856Z f803d66 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.

cursoragent and others added 3 commits November 7, 2026 11:55
OpenJDK still reserves two sockaddr_un bytes, so the path cap stays
102 on macOS and 106 on Linux. The real Ghidra run also keeps the
project-identity check from main.
@morluto
morluto merged commit f912a68 into main Nov 7, 2026
49 of 51 checks passed
@morluto
morluto deleted the codex/ghidra-java-socket-boundary branch November 7, 2026 18:15
@morluto morluto added bug Something isn't working provider: ghidra Analysis provider / engine: ghidra labels Nov 23, 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] Ghidra startup fails at the macOS Unix socket path boundary

2 participants