Repository navigation
feat(ghidra): admit DOS MZ targets on Windows P0 - #7144
Conversation
[Medium impact] The PR appears safe to merge; the earlier Windows verification failure is fixed. SummaryAdds read-only DOS MZ analysis to Windows Ghidra P0 through the existing DOS import path.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[DOS MZ target on Windows] --> B[Windows P0 admission]
B --> C[Existing MzLoader import]
C --> D[Read-only analysis]
D --> E[Return analysis results]
D --> F[Refuse annotation and naming edits]
Reviews (7) · Last reviewed commit: "fix(ghidra): expect an unchanged DOS ent..." · Reviewed by Greptile |
1541bc1 to
5b5fd74
Compare
Codex Review SummaryThis 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. |
Windows Ghidra P0 refused dos-mz although the MzLoader import, 16-bit real-mode language attestation and load-image evidence are host-neutral. Admit dos-mz in inspectWindowsP0TargetSupport and run verify:ghidra:dos on Windows: inherit the system environment there, expect annotation and naming edits to be refused (P0 has no mutation authority), and skip verifier lineage like the 6502 lane. Explicit COM stays refused on Windows; its verifier is built around annotation edits. Refs morluto#7121 Co-Authored-By: Claude Opus 5.5 <[email protected]>
With mutable: false the address-boundary helper skipped every naming request, so the Windows report overstated its coverage. Assert that set_address_name and set_addresses_names are refused with capability_unavailable and leave the entry name unchanged, and declare the optional mutable argument in the .d.mts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
078a6e7 to
dc3f9e4
Compare
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Hey @dark13b, thanks for this! The addition looks good. What's left: it has merge conflicts with main in |
…dos-mz # Conflicts: # docs/testing.md # docs/windows-ghidra-p0.md
Windows P0 refuses edits, so verifyGhidraAddressBoundaries skips the rename-and-restore and the entry keeps its imported symbol source. The post-check still expected user_defined, which only follows a rename. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
Summary
Refs #7121. On Windows,
open_binarydetects a DOS MZ executable (dos-mz/x86), but Windows Ghidra P0 admits only native PE and raw 6502 images, so every later operation fails. This PR admitsdos-mzon Windows P0 through the existing DOS import path and makesverify:ghidra:dosrun on Windows.Refsrather thanFixes: explicit COM and opening an existing Ghidra project (the other parts of the report) are not included.Problem and expected behavior
Trigger:
open_binaryon any DOS MZ executable on a Windows host, then any provider operation.inspectWindowsP0TargetSupportreturnstarget_format_unsupported, although the MzLoader import, thex86:LE:16:Real Modelanguage attestation and the independent load-image evidence don't depend on the host platform.Expected: the same read-only DOS MZ analysis that Linux and macOS provide, under the existing Windows P0 native ownership and path-admission boundary. Annotation and naming edits stay refused, because Windows P0 has no mutation authority.
Change and scope
src/ghidra/GhidraProvider.ts:inspectWindowsP0TargetSupportadmitsdos-mzbefore the PE-only checks, as feat(ghidra): support raw NMOS 6502 analysis #2079 did for raw 6502. Profile resolution, launcher arguments and language attestation are the existing DOS path. The Windows-specific source path, loopback transport and Job Object ownership don't depend on the format.scripts/verify-real-ghidra-dos.mjsruns on Windows:SystemRootand the profile paths);capability_unavailable;verify:ghidra:6502does on Windows.scripts/lib/real-ghidra-address-boundaries.mjstakes{ mutable }. Read-only truncation checks still run on Windows, andannotate_native_function,set_address_nameandset_addresses_namesmust each be refused withcapability_unavailablewithout changing the entry name. The.d.mtsdeclares the option. The alias-naming edits move into a helper that runs only when edits are allowed. The CLI truncation checks now run before the alias edits instead of after.Not included:
verify:ghidra:comis built around annotation edits. It needs a separate read-only port before COM can be admitted with real-provider evidence..gprfile is a zero-byte marker; the lane always imports into an ephemeral project. Supporting it would be a new target kind.provider_unavailablewording when unconfigured providers could support the target. Not changed here.Contribution scope: this extends an existing read-only lane to another host within the Windows P0 boundary. There is no new execution, injection, mutation or protection-recovery capability. It does widen the documented Windows P0 format set, so maintainers may want to confirm that scope.
Contract and boundary impact
GhidraProvider.inspectTargetSupport(Windows P0 admission). Consumers: provider selection, snapshot replay and session admission all route through it. No superseded paths.dos-mz.dos-comand other non-PE formats stay refused there.Expected effects:
Evidence and regression coverage
GhidraProvider.behavior.test.tshas a new case, "Ghidra Windows DOS admission". On awin32installation host it checks thatdos-mzis supported and resolves the MzLoader /x86:LE:16:Real Mode/ load segment0x1000profile, and thatdos-comis stilltarget_format_unsupported. The old assertion that pinned DOS MZ as unsupported on Windows is removed.GhidraProvider.tsrestored, the new case fails (1 failed, 167 passed); with the change it passes.npm run verify:ghidra:doson Windows generates the source-owned MZ fixture (no copyrighted binary) and checks the following through real MCP and CLI calls:verified;verify:ghidra:comwas not run. Process-lineage observation is unavailable on Windows (provider jobs are owned natively, as in the 6502 lane).Boundary regressions covered: target admission per host, and malformed or oversized coordinates through real reads (Windows). Lifecycle: owned project and runtime cleanup observed by the real lane.
For evidence-bearing changes:
Validation performed
Host: Windows 11 Pro x64, Ghidra 12.1.4, Temurin JDK 21.0.12, Node 24.21.0. That Node is below the pinned 24.22.1, so dependencies were installed with
npm ci --engine-strict=false.npm ci --engine-strict=false— succeedednpm run build:cached— passednpm run test:local -- src/ghidra/GhidraProvider.behavior.test.ts— 168 passed (re-run onb8ce3c74ctogether withsrc/contracts/toolInputReferences.test.ts: 202 passed)npm run check:fast— passed (run on6381aa0b1)npm run verify:test-discovery— all 2485 test files discovered exactly oncenpm run verify:ghidra:dos(Windows, before the rebase) —ok: true,cleanup: completenpm run verify:ghidra:dos(Windows, rebased onb8ce3c74c, at078a6e7ef) —ok: true,cleanup: complete, including the naming-refusal checksnpm run test:local -- src/ghidra/GhidraProvider.behavior.test.ts src/ghidra/GhidraDolProfile.test.tsandnpm run test:focused -- tests/boundary/providers/ghidra/ghidraTargetSnapshot.test.ts tests/boundary/providers/ghidra/ghidraClient.test.ts— 4 and 66 failures on this Windows checkout. Restoring the base files gave identical failure lists (POSIX-only fixtures, as CONTRIBUTING notes); no new failures.npm run check,npm run docs:check, the POSIX real DOS lane.Compatibility, safety, and release
Author readiness
Human owner: @dark13b
Before merge
type(scope): outcome.🤖 Generated with Claude Code