Repository navigation
Conversation
Map freebsd/x64 to Ghidra's freebsd_x86_64 native directory (found under build/os in FreeBSD packages), expect ELF native tools, and accept a JVM reporting os.name=FreeBSD.
BSD ps treats everything after the first '=' in -o as the column header, so pass one -o per column. FreeBSD has no 'sess' keyword; use 'sid' there. Without procfs, read process identities on FreeBSD from one ps snapshot: lstart as the start identity, plus parent, process group, effective UID and zombie/exiting state. FreeBSD ps exits 1 without output when none of the requested PIDs exists; report those PIDs as absent. This lets owned-process baselines and cleanup revalidation work, which the Ghidra provider requires to launch Java.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Low impact] The narrowed inspection-only change appears safe to merge; it does not enable FreeBSD execution. SummaryRecognizes FreeBSD’s native decompiler path and ELF header without enabling Ghidra execution.
Reviews (3) · Last reviewed commit: "fix(ghidra): keep FreeBSD inspection out..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74d78d6f72
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
TL;DR: The PR adds no tests, so I ran 21 existing Linux test files for the changed code on Node 22.23.4, 24.22.1 and 26.12.1. All passed on each version, with 1 test skipped. I did not run FreeBSD, and the
Not run
Test setupCommandsnpm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- src/process/ProcessOwnership.baselineAbsence.test.ts src/process/ProcessOwnership.exitScope.test.ts src/process/ProcessOwnership.exiting.test.ts src/process/ProcessOwnership.finalSweep.test.ts src/process/ProcessOwnership.identity.test.ts src/process/ProcessOwnership.lineage.test.ts src/process/ProcessOwnership.nativeExit.test.ts src/process/ProcessOwnership.observation.test.ts src/process/ProcessOwnership.part2.test.ts src/process/ProcessOwnership.part3.test.ts src/process/ProcessOwnership.procIdentity.test.ts src/process/ProcessOwnership.runId.test.ts src/process/ProcessOwnership.sweepExit.test.ts src/process/ProcessOwnership.test.ts src/process/ProcessOwnership.tokenAvailability.test.ts src/process/ProcessOwnership.validation.test.ts src/process/ProcessOwnershipFacts.test.ts src/process/capture/ProcessCaptureOwnershipEvidence.test.ts src/process/capture/ProcessSampling.procReadCoverage.test.ts src/ghidra/GhidraInstallation.test.ts tests/boundary/filesystem/recordedCrashTraceClassifier.test.ts🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
|
I've opened #13140 as an attributed draft continuation. It preserves @ocochard's original commits, reconciles current main, and carries the process-observation fixes and controlled tests. The draft records the remaining FreeBSD scope decision, native identity and token evidence, and real-host cleanup validation. On this original PR, Thanks @ocochard for the FreeBSD reproduction, initial implementation, and real Ghidra smoke test. |
|
@ocochard Thanks for the FreeBSD reproduction, the original implementation, and the Ghidra smoke test. We’re continuing here on your PR. I fast-forwarded the branch to The old reader treated any row it could not parse as proof of exit. The follow-up parses each row independently and keeps malformed or invisible PIDs unresolved. We verified the regression by restoring the old classification and seeing both tests fail. The focused macOS run passed 552 tests with two skips, and FreeBSD owned launches are gated on this head. FreeBSD can hide a live PID from Could you review the changes and let us know whether your FreeBSD/amd64 host is available for the next round of native validation? The original readiness check requires the three declarations from the human owner. Please complete them when you consider the PR ready for review. |
morluto
left a comment
There was a problem hiding this comment.
Reviewed current head 49d7b18548. The diff adds read-only Ghidra package inspection on FreeBSD/amd64. It identifies the packaged x86-64 ELF decompiler, reports unsupported_host, and skips the Java probe. The regression fails if that probe runs. Shared process ownership and sampling match main.
The title still says “support FreeBSD hosts,” which implies execution. If this revision is intended to ship on its own, feat(ghidra): inspect FreeBSD amd64 installations describes what users get. If the goal remains executable support, the remaining review is the maintainer scope decision and real FreeBSD evidence for generation identity, run-token provenance, cancellation, and cleanup retry.
Local validation on macOS/arm64 passed check:fast and 923 focused tests with two skips. The FreeBSD boundary was exercised with a fixture.
Current revision
49d7b18548limits the current change to read-only FreeBSD/amd64 Ghidra package inspection. REA identifies the packaged ELF decompiler and returnsunsupported_hostbefore probing Java. The shared ownership and sampling code matches main.The earlier prototype's shared preflight blocked unrelated workers, while a lower-level signaling path could still treat a one-second
lstartvalue as generation identity. The original commits and prototype remain in the branch history. FreeBSD execution still needs a scope decision, native generation and run-token evidence, and real-host cancellation and cleanup verification.On macOS/arm64, 923 focused tests passed with two skips and
npm run check:fastpassed. The regression also showed that removing the platform guard attempted the JVM probe. The original submission below records @ocochard’s reproduction and native smoke test on the earlier stacked branch.Summary
Let the Ghidra provider run on FreeBSD/amd64 hosts. Today
rea doctorreports Ghidra as unavailable on FreeBSDeven with a working Ghidra installation, because REA rejects the platform, cannot find the FreeBSD native decomp
iler, and cannot track the processes it launches (the Java probe fails), since process identities are read only
from Linux procfs or the Darwin reader.
Problem and expected behavior
On FreeBSD 16.0-CURRENT amd64 with the
ghidrapackage (GHIDRA_INSTALL_DIR=/usr/local/share/ghidra),rea doc torreports for Ghidra:Underlying causes:
NATIVE_PLATFORMS/NATIVE_TOOL_FORMATShave nofreebsdentry, and the JVMos.namecheck has no FreeBSD case. The FreeBSD package ships the decompiler at
Ghidra/Features/Decompiler/build/os/freebsd_x86_64/decompil e, a path REA already searches once the platform is mapped.ps -axo pid=,ppid=,...is procps syntax. BSDpstreats everything after the first=as the column header, so the process listing returns only PIDs. FreeBSD also has no
sesskeyword (sidis the session id).processIdentities/captureBaselineexist only for Linux and Darwin, so owned-process launches that require a baseline (the Ghidra Java probe) fail.Expected: with a supported Ghidra release and JDK, Ghidra is
available: trueon FreeBSD/amd64, and owned processes are tracked and cleaned up as on Linux.Change and scope
src/ghidra/GhidraInstallation.ts: mapfreebsd/x64tofreebsd_x86_64, expect ELF native tools, acceptos.name=FreeBSD.src/process/ProcessOwnershipObservation.ts,src/process/capture/ProcessSampling.ts: pass one-operpscolumn (valid for both procps and BSDps), usesid=instead ofsess=on FreeBSD.src/process/ProcessOwnershipObservation.ts: add a FreeBSD identity reader based on oneps -o pid= -o ppid= -o pgid= -o uid= -o stat= -o lstart= -p <pids>snapshot. It gives afreebsd-lstart:start identity, the relation (parent, process group), effective UID and lifecycle (Zmeans zombie,Emeans exiting). A PID missing from the snapshot is reportedabsent. FreeBSDpsexits 1 without output when none of the requested PIDs exist, and that case is also treated as all absent. EnablecaptureBaseline/processIdentitiesfor FreeBSD.Not included: setup/installer support for FreeBSD, other providers (JADX, NativeAOT and PSP remain Linux-only), arm64 FreeBSD. Accepting newer Ghidra 12.x minors is a separate PR.
Known limitation:
lstarthas one-second resolution, so the start identity cannot tell apart two processes that get the same PID within the same second. On FreeBSD that needs the PID space to wrap within one second, which is unlikely, but it is weaker than Linux's clock-tick start time. Asysctl kern.proc.pidreader (microsecondki_start) would be stronger but needs native code.Follow the contribution scope. Scope decision pending: this adds a new host platform.
Contract and boundary impact
createSystemProcessOwnershipHost(process listing and identities) and Ghidra installation inspection. Linux and Darwin paths unchanged apart from thepsargument form.pssnapshots, see the limitation above.docs/public/product-catalog.json), package, or installation impact: none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
rea doctoroutput above, on unpatchedmain.rea doctorreports Ghidra asavailable: truewithnative_decompiler,true,null,".../build/os/freebsd_x86_64/decompile reports elf x86_64, which matches freebsd/x64", andrea decompile <elf> square --provider ghidrareturnsint square(int param_1) { return param_1 * param_1; }. Afterwards no Ghidra or decompiler processes are left running.Validation performed
Host: FreeBSD 16.0-CURRENT amd64, Node v24.21.0 (below
engines, dependencies installed with--engine-strict=false), OpenJDK 25.0.4, Ghidra 12.2 (FreeBSD package).node scripts/run-typescript.mjs --noEmiton this branch: passed.npx vitest run src/ghidra/GhidraInstallation.test.tson this branch: 104 passed, 6 failed. The same 6 (keeps JDK registration identity for ...) fail on unpatchedmainon this host.viteston 71 files covering process ownership, process capture and Ghidra installation, run on this branch plus the Ghidra 12.x PR: 44 failed / 795 passed / 45 skipped, against 90 failed / 749 passed on unpatchedmainon the same FreeBSD host. No test fails only with the change. These failures come from the FreeBSD host and are unrelated to this change.rea doctorandrea decompileas above. These need Ghidra 12.2 accepted, so they ran with the Ghidra 12.x PR applied.Compatibility, safety, and release
psoutput, with a one-second start-time resolution (see limitation).Author readiness
Human owner: @ocochard
Before merge
type(scope): outcome.