Repository navigation
feat(elf): report separate debug-file linkage and verify a candidate debug file - #9560
Conversation
…debug file inspect_elf_debug_link and inspect-elf-debug-link read one local ELF32 or ELF64 image and report its .gnu_debuglink name and CRC32, its .gnu_debugaltlink name and build-id, its GNU build-id from PT_NOTE and SHT_NOTE, and .gnu_debugdata presence, plus the conventional GNU/Linux lookup path strings, which are not opened. With a caller-selected candidate, the candidate is streamed in bounded chunks and its CRC32 and GNU build-id are compared, returning matches, does_not_match or cannot_verify. Nothing is executed or searched for. Names, build-ids and note scans are bounded, target-derived names are marked untrusted, and the MCP input schema requires absolute paths.
Codex Review Summary: ❌ FailedThis 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. |
[Medium impact] The reviewed changes appear safe to merge, with no new actionable findings. SummaryAdds offline ELF debug-file inspection and verification of one caller-selected candidate.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CLI or MCP request] --> B[Validate selected paths and limits]
B --> C[Stable read of selected ELF image]
C --> D[Decode linkage and build-ids]
D --> E{Candidate selected?}
E -->|No| H[Create Evidence]
E -->|Yes| F[Stream selected candidate]
F --> G[Compare CRC32 and available build-id]
G --> H
F -->|Cancellation or failed close| I[Retain completed observations]
I --> J[Attach caller Evidence to matching errors]
J --> K[Preserve Evidence after cleanup retry]
Reviews (20) · Last reviewed commit: "fix(elf): retain caller Evidence through..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 779b36250d
ℹ️ 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".
The documentation guide assigns analyst workflows to docs/guides/<domain>/. Move the guide there, place its navigation and directory entries in the Native binaries group, and update links from the docs index, CLI guide, spec and authored skill. The public /elf-debug-link route is unchanged.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a801927de0
ℹ️ 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".
…e failed candidate close parseElfNotes accepts maxGnuBuildIdBytes and leaves a larger GNU build-id descriptor undecoded, so inspect_elf_debug_link judges the 256-byte limit from descsz before any hex expansion, for both the image and the candidate. build_id.sources lists each contributing GNU build-id note with its table kind, table index, and note and descriptor file ranges, so distinct or conflicting ids stay traceable to their notes. A candidate read that failed with integrity or limit and whose close also failed now fails the call instead of returning candidate_unreadable, so the pending handle stays visible.
…bug-file-linkage # Conflicts: # docs/specs/README.md
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7dd630703
ℹ️ 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".
…ate failures
Retain the decoded image report as partial Evidence when the candidate
phase fails (cancellation, close failure, path refusal). A candidate
stream that completed before cancellation or a failed close keeps its
full comparison, including whole-file SHA-256 and size.
completedStableArtifact recognized only buffered {bytes, sha256}
completions. Stream completions {sha256, size, prefix} now recover their
whole-file identity from size, so file-snapshot observations no longer
drop a completed stream.
A candidate data-read EIO is classified as unreadable, so inspect returns
cannot_verify with the image linkage instead of discarding it.
Evidence construction moves to src/domain/native/elfDebugLinkEvidence.ts
so the provider and service share one interpretation.
…CLI spelling candidateSections reported .debug_info and .symtab as present from the section name alone. A declaration whose range is not inside the file now leaves that section unknown instead of claiming the candidate adds debug information or symbols. The CLI resolved --candidate-path before Evidence and only bound the image's original spelling. finishCliEvidenceCommand now accepts additional caller paths, and inspect-elf-debug-link binds the candidate as caller_input_paths.candidate_path, matching inspect-api-contract.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6a0463139
ℹ️ 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".
A compressed .shstrtab was inflated by readElfImage under the directory's fixed 16 MiB structural allowance before observeBuildId checked the caller-selected source-plus-decoded-names budget, so a small max_file_bytes did not prevent the allocation it refuses. Check the declared decoded size against the remaining allowance before either decoder runs, for the image and for the candidate.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2735594326
ℹ️ 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".
…ports The early name-expansion check read the compression header itself and rejected an image whose .shstrtab used an unsupported compression type with a large declared size, although no decoder would inflate it and the build-id was still recoverable. Expose the section-name table's header facts from its owning reader and charge the budget only for zlib or zstd.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b8c91cc37
ℹ️ 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".
The early name-expansion check read the raw e_shnum, so an image whose section count lives in section zero skipped the check while readElfImage still inflated .shstrtab under its structural allowance. Use the section directory's resolved table declarations, which include extended counts.
Resolve cliEvidenceCallerPath.ts by taking upstream's CallerInputPaths type for additionalPaths, which covers this branch's single candidate path.
# Conflicts: # src/artifacts/StableArtifactObservation.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e57a0c8c2a
ℹ️ 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".
A fully read image that then fails ELF decoding or exceeds max_entries now forwards its completed snapshot to projectStableArtifactFailure, so callers receive the file-snapshot-hash partial observation, matching ElfNotesProvider.
Picks up the upstream compilation fix for the duplicate packageName declaration in src/cli/adbCommands.ts that the previous main merge carried into this branch.
|
The |
Keep the streamed stable read and pass main's validated-state observer through it; register inspect-elf-debug-link through main's contract projection with candidate_path as a caller path; keep the provider below the application layer; and record the full-profile dialect counts the new tool adds.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Main replaced the per-tool register files with the service binding table and declares standalone availability on contracts, so inspect_elf_debug_link now binds through serviceToolBindings, declares availability "standalone", and registerElfDebugLinkTool.ts is removed. Main also replaced ElfNoteSectionNameBudgetFailure with a shared ParseFailureError limit, so assertElfSectionNameBudget throws that limit and the debug-link reader, provider and tests read it through elfNoteSectionNameBudget.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Merged current main in f3bef99 to clear the conflicts in src/application/CapabilityInventory.ts, src/server/createServer.ts and src/native/elf/ElfNoteParser.ts. inspect_elf_debug_link now binds through serviceToolBindings.ts with availability "standalone" in place of its register file, and the debug-link reader and provider read main's shared section-name budget limit instead of the removed ElfNoteSectionNameBudgetFailure class. |
Bind the tool through main's shared service binding table, declare its availability on the contract, and report coverage with the shared coverage vocabulary that main's new guards require.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Keep inspect_elf_debug_link as a contract CLI command after command names moved onto each tool, and keep the debug-link section-name budget on main's shared decoder.
|
Merged current main in e7530b4 to clear the new conflicts. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Resolve the import conflict in src/native/elf/ElfNoteParser.ts by keeping both sides: the branch's section-directory and section-name-table header readers, and main's sha256Hex helper.
Main now requires every integrity ArtifactReaderFailure to name its check, so the provider tests pass container-identity for a changed candidate.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Merged current main again in a184f30 to clear the new conflict. On Node 24.22.1, |
Preserve both ELF diagnostics registrations and use the completed stable-read identity for buffered and streamed failure observations. Co-authored-by: gensokyo-dev <[email protected]>
Keep complete and partial Evidence creation in the application service with caller-selected parameters. Migrate shared ELF note budgets and their debug-link, notes and hardening consumers to canonical parse limits. Preserve completed stream identity and failed-close ownership, with distinct candidate read-ceiling recovery. Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning) Co-authored-by: gensokyo-dev <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
gensokyo-dev
left a comment
There was a problem hiding this comment.
Reviewed the selected-path offline scope and integration with current main. Canonical note budgets preserve hardening facts; complete and partial Evidence share the application owner and preserve caller selections. Focused public/lifecycle checks and real GCC/objcopy CLI plus stdio MCP match/mismatch controls passed. Exact-head CI and automated review remain the merge gates.
Normalize each cleanup owner sharing the same partial report to the same application Evidence, so cleanup release cannot expose stale parameters. Register the provider lifecycle coverage with its public operation and cancellation controls. Co-authored-by: gensokyo-dev <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary
Add offline
inspect-elf-debug-link/inspect_elf_debug_linkfor ELF32/ELF64 debuglink/altlink declarations, GNU build IDs, conventional lookup strings and MiniDebugInfo presence. Only the selected image and optional selected candidate are opened; neither is executed. Candidate CRC32 and SHA-256 stream over the complete file while retained decoding bytes stay bounded.Integrate current shared ownership: canonical named parser limits, completed buffered/streamed identity, preserved cancellation and failed-close resources, and application-owned complete/partial Evidence with original caller selections across cleanup completion. Hardening retains confirmed PIE/NX/RELRO when a shared note budget stops decoding. The candidate's fixed whole-file ceiling has distinct recovery from the image's selected read budget.
Validation
matchesfor split debug info anddoes_not_matchfor a one-byte altered candidate. Independentreadelfbuild IDs and Python CRC32 agreed; target hashes stayed unchanged. The target was not executed.Local expensive checks ran serially under one CPU and an 8 GiB hard / 6 GiB early-stop memory budget; no OOM occurred. Full typed lint was not rerun after exceeding that local budget during the preceding integration. Real dwz altlinks, distribution debuginfo packages and MiniDebugInfo decoding were not verified; MiniDebugInfo remains presence-only.
Author readiness
Human owner: @mvanhorn