Skip to content

fix(elf): check load-map agreement across section extents - #12175

Merged
morluto merged 3 commits into
audit/parser-native-formatsfrom
audit/parser-elf-section-extents
Nov 19, 2026
Merged

morluto merged 3 commits into
audit/parser-native-formatsfrom
audit/parser-elf-section-extents

Conversation

@morluto

@morluto morluto commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

ELF dependency inspection now checks the entire section span against PT_LOAD before admitting a section for a dynamic table. It still recovers from a plain mapping gap when the section starts at the agreed file offset. A different file translation or declared zero-fill prevents the section from supplying file bytes. An agreed section header still establishes its linked string-table declaration even when symbol bytes are unreadable.

Refs #12136 and #12156. This is stacked on the shared mapping fix so its review shows only extent admission for sibling tables.

Problem and expected behavior

The prior section admission checked one byte at the start of the range. The new static fixture placed a zero-fill disagreement later in the dynamic symbol table and the prior parser still reported five import names. The fixed result leaves the imports unreadable with partial coverage and retains the independent DT_NEEDED names. The control changes only the zero-fill declaration and retains the five expected imports. A second case combines disagreeing symbol bytes with a recoverable string-table mapping gap. It verifies that the reader still uses the independently agreed string table to retain the three needed library names.

The ELF gABI describes the memory beyond a load segment's file bytes as zero-initialized. The shared virtual mapper provides those facts to the ELF dependency reader. ELF gABI program headers

Contract and boundary impact

  • The shared section-admission step covers symbols, versions, hashes, and strings. The tool's section-recovery policy uses the typed mapping facts.
  • Existing CLI and MCP contracts are unchanged. Partial evidence still retains independently readable rows.
  • Existing static artifact read authority applies. No loader, provider, or executable ran.

Validation performed

  • The new regression failed at cb54cc472a before changing the parser. The adjacent positive control still passes.
  • 134 focused checks passed at d7f2d699a2 on Node 24.22.1 across the ELF dependency parser, mapping parity, desktop ELF reader, public CLI, and MCP boundary.
  • npm run check:fast, npm run docs:check, and git diff --check passed.
  • Real loader behavior and non-macOS runtime verification remain open.

Author readiness

Human owner: @morluto

  • 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.

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

chatgpt-codex-connector Bot commented Nov 19, 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-19T03:16:28.638841Z d7f2d69 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.

@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge based on the inspected code.

Summary

ELF dependency inspection now checks each section’s full span against the load mapping while preserving independently readable library names.

  • ELF dependency tables now check their full spans against load mappings.

The previous library-name finding is fixed. No new actionable issues or security regressions were found. Tests were inspected, not run.

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

Comment thread src/native/elf/ElfDependencyParser.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f17e02dda

ℹ️ 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".

Comment thread src/native/elf/ElfDependencyParser.ts Resolved
@morluto
morluto merged commit d527346 into audit/parser-native-formats Nov 19, 2026
1 check passed
@morluto
morluto deleted the audit/parser-elf-section-extents branch November 19, 2026 03:18
morluto added a commit that referenced this pull request Nov 19, 2026
#12156)

* fix(elf): share dynamic table singleton validation

* fix(elf): share note storage and framing across readers

Refs #12130

* fix(elf): retain zero-filled load mapping ambiguity

Refs #12136

* fix(pe): share header extent admission

Refs #12143

* fix(macho): share embedded section backing checks

Refs #12142

* fix(pe): share header facts and validate resource directory order

* fix(macho): require complete carrier load command framing

* fix(pe): probe declared resource headers by file offset

* fix(elf): preserve zero-fill observations across mapping gaps

* refactor(pe): share positional COFF header observation (#12173)

* fix(elf): check load-map agreement across section extents (#12175)

* fix(elf): check load-map agreement across section extents

* fix(elf): preserve agreed section links across unreadable tables
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant