[PR #3772] fix(android): disable JVM perf data for JADX Java launches #5886

Open
opened 2026-10-31 01:10:12 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3772
Author: @FabioLima77
Created: 10/15/2026
Status: 🔄 Open

Base: main ← Head: fix/jadx-java-perf-data


📝 Commits (2)

  • e36d3db fix(android): disable JVM perf data for JADX Java launches
  • a6dd79b Merge origin/main into fix/jadx-java-perf-data

📊 Changes

4 files changed (+13 additions, -5 deletions)

View changed files

📝 src/android/JadxConfiguration.ts (+6 -2)
📝 src/android/JadxJavaProbe.ts (+4 -1)
📝 tests/boundary/android/jadxConfiguration.test.ts (+2 -1)
📝 tests/fixtures/android/jadx.ts (+1 -1)

📄 Description

Requested by Fabio Lima · project thread

Summary

JADX Java launches left a hsperfdata_<user> directory in the caller's temp directory. With REA_JADX_MCP_JAR configured, npm run verify:ghidra:windows failed its runtime-cleanup assertion even though every functional Ghidra check passed. JADX launches now pass -XX:-UsePerfData, as Ghidra launches already do.

Problem and expected behavior

  • Trigger: Windows x64, JDK 21, REA_JADX_MCP_JAR set, then npm run verify:ghidra:windows.
  • Observed: AssertionError ... actual: [ 'hsperfdata_fabio' ], expected: [] at scripts/lib/real-ghidra-file-offsets.mjs:207 (the verifier points TEMP/TMP at its private runtime directory).
  • Source-derived cause: JADX readiness runs java --list-modules (src/android/JadxConfiguration.ts) without -XX:-UsePerfData, so the JVM creates its perf-data directory under the caller's temp directory. Ghidra launches (GhidraLauncher.ts, GhidraInstallation.ts) already disable it.
  • Expected: REA-owned Java launches leave no residue in the caller's temp directory.

Change and scope

JadxConfiguration.ts now owns a single JADX_JVM_BASE_ARGUMENTS = ["-XX:-UsePerfData"], used by both the module-listing probe and resolveJvmArguments (the bridge JVM launch). Caller-selected heap and processor options keep their order after it. Ordinary fix within existing boundaries; maintainer scope decision: not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/android/JadxConfiguration.ts (JADX JVM argument construction).
  • Contribution scope fit and linked maintainer decision: not applicable (fix within the existing JADX provider boundary).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: JVM flag supported by all JDKs REA accepts; no output change.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: removes JVM perf-data residue from the caller's temp directory.
  • Generated metadata, package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).

  • 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

  • Tests added or updated: tests/boundary/android/jadxConfiguration.test.ts expects the flag in jvmArguments; the JADX protocol fixture's fake java only answers the exact -XX:-UsePerfData --list-modules probe.
  • Base reproduction or other evidence: on the base revision the real verifier fails as above; with the change it passes. Directly with JDK 21.0.12: java --list-modules under an isolated TEMP leaves hsperfdata_<user>; java -XX:-UsePerfData --list-modules leaves nothing.
  • User-visible CLI/MCP output: none.
  • Remaining proof gaps: the updated JADX configuration tests are skipped on Windows (POSIX fake JDKs) and were not executed locally; a real APK analysis through the JADX bridge was not run.

Validation performed

  • npm run check:fast — passed (typecheck, lint).
  • npm run verify:ghidra:windows with REA_JADX_MCP_JAR set, base revision — exit 1 (cleanup assertion above).
  • npm run verify:ghidra:windows with REA_JADX_MCP_JAR set, this change — exit 0 in 130 s; ok: true, cleanup: complete, file_offsets.cleanup: complete.
  • After rebasing onto c9764084b: npm run deps:check, npm run check:fast — passed; npm run verify:ghidra:windows with REA_JADX_MCP_JAR set — exit 0 in 140 s, same ok/cleanup results.
  • rea doctor --provider jadx --json with an isolated TEMP — jadx healthy; temp directory empty afterwards.
  • npm run test:focused on 6 Android test files on Windows — 5 failures identical before and after the change (fake JDK lacks java.exe on Windows); relevant configuration tests skipped.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: real Ghidra 12.1.4 + Microsoft OpenJDK 21.0.12 on Windows 11 x64 (verifier above); JADX readiness against real jadx-headless-mcp 0.7.1 JAR. No Linux/macOS run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: reduces filesystem residue; no new authority.

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.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W2jkGVJrgYwKuWHzqQQYXc


🔄 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/3772 **Author:** [@FabioLima77](https://github.com/FabioLima77) **Created:** 10/15/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/jadx-java-perf-data` --- ### 📝 Commits (2) - [`e36d3db`](https://github.com/morluto/rea/commit/e36d3db773bfa2860d190b9e8fc52a8361b2d309) fix(android): disable JVM perf data for JADX Java launches - [`a6dd79b`](https://github.com/morluto/rea/commit/a6dd79be21f150a3d482e33629b415a3c8b4c962) Merge origin/main into fix/jadx-java-perf-data ### 📊 Changes **4 files changed** (+13 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/android/JadxConfiguration.ts` (+6 -2) 📝 `src/android/JadxJavaProbe.ts` (+4 -1) 📝 `tests/boundary/android/jadxConfiguration.test.ts` (+2 -1) 📝 `tests/fixtures/android/jadx.ts` (+1 -1) </details> ### 📄 Description <!-- claude-projects-attribution --> _Requested by **Fabio Lima** · [project thread](https://claude.ai/code/project/chan_018SVc5tzqnEp4MSY6rxYUKK?thread=cmsg_018SVc5tzqnEp4MSY6rxYUKK2JwVWeUiq3zQpLnr6RzjkJ)_ ## Summary JADX Java launches left a `hsperfdata_<user>` directory in the caller's temp directory. With `REA_JADX_MCP_JAR` configured, `npm run verify:ghidra:windows` failed its runtime-cleanup assertion even though every functional Ghidra check passed. JADX launches now pass `-XX:-UsePerfData`, as Ghidra launches already do. ## Problem and expected behavior - Trigger: Windows x64, JDK 21, `REA_JADX_MCP_JAR` set, then `npm run verify:ghidra:windows`. - Observed: `AssertionError ... actual: [ 'hsperfdata_fabio' ], expected: []` at `scripts/lib/real-ghidra-file-offsets.mjs:207` (the verifier points `TEMP`/`TMP` at its private runtime directory). - Source-derived cause: JADX readiness runs `java --list-modules` (`src/android/JadxConfiguration.ts`) without `-XX:-UsePerfData`, so the JVM creates its perf-data directory under the caller's temp directory. Ghidra launches (`GhidraLauncher.ts`, `GhidraInstallation.ts`) already disable it. - Expected: REA-owned Java launches leave no residue in the caller's temp directory. ## Change and scope `JadxConfiguration.ts` now owns a single `JADX_JVM_BASE_ARGUMENTS = ["-XX:-UsePerfData"]`, used by both the module-listing probe and `resolveJvmArguments` (the bridge JVM launch). Caller-selected heap and processor options keep their order after it. Ordinary fix within existing boundaries; maintainer scope decision: not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/android/JadxConfiguration.ts` (JADX JVM argument construction). - Contribution scope fit and linked maintainer decision: not applicable (fix within the existing JADX provider boundary). - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: JVM flag supported by all JDKs REA accepts; no output change. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: removes JVM perf-data residue from the caller's temp directory. - Generated metadata, package, or installation impact: none. Expected effects (check known effects; use documentation-only on its own). - [ ] Read existing files or captured data. - [x] 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 - Tests added or updated: `tests/boundary/android/jadxConfiguration.test.ts` expects the flag in `jvmArguments`; the JADX protocol fixture's fake `java` only answers the exact `-XX:-UsePerfData --list-modules` probe. - Base reproduction or other evidence: on the base revision the real verifier fails as above; with the change it passes. Directly with JDK 21.0.12: `java --list-modules` under an isolated `TEMP` leaves `hsperfdata_<user>`; `java -XX:-UsePerfData --list-modules` leaves nothing. - User-visible CLI/MCP output: none. - Remaining proof gaps: the updated JADX configuration tests are skipped on Windows (POSIX fake JDKs) and were not executed locally; a real APK analysis through the JADX bridge was not run. ## Validation performed - `npm run check:fast` — passed (typecheck, lint). - `npm run verify:ghidra:windows` with `REA_JADX_MCP_JAR` set, base revision — exit 1 (cleanup assertion above). - `npm run verify:ghidra:windows` with `REA_JADX_MCP_JAR` set, this change — exit 0 in 130 s; `ok: true`, `cleanup: complete`, `file_offsets.cleanup: complete`. - After rebasing onto `c9764084b`: `npm run deps:check`, `npm run check:fast` — passed; `npm run verify:ghidra:windows` with `REA_JADX_MCP_JAR` set — exit 0 in 140 s, same `ok`/`cleanup` results. - `rea doctor --provider jadx --json` with an isolated `TEMP` — `jadx` healthy; temp directory empty afterwards. - `npm run test:focused` on 6 Android test files on Windows — 5 failures identical before and after the change (fake JDK lacks `java.exe` on Windows); relevant configuration tests skipped. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: real Ghidra 12.1.4 + Microsoft OpenJDK 21.0.12 on Windows 11 x64 (verifier above); JADX readiness against real jadx-headless-mcp 0.7.1 JAR. No Linux/macOS run. - Package or release metadata impact: none. - Security, privacy, process, or containment review: reduces filesystem residue; no new authority. ## Author readiness Human owner: <!-- @GitHub-handle --> - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01W2jkGVJrgYwKuWHzqQQYXc --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5886
No description provided.