Skip to content

fix(hopper): probe interior navigation from multi-byte instructions - #1285

Merged
morluto merged 1 commit into
morluto:mainfrom
BaaRai:fix/real-hopper-interior-navigation
Oct 9, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
BaaRai:fix/real-hopper-interior-navigation

Conversation

@BaaRai

@BaaRai BaaRai commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Summary

The real-Hopper boundary-contract navigation probe derived its interior coordinate as anchor + 1, which silently assumes the fixture procedure's first instruction is longer than one byte. On host toolchains that compile the fixture prologue without endbr64 padding, the first instruction is the one-byte push rbp, so anchor + 1 is itself an instruction boundary: goto_address correctly snaps to (and reports) that boundary, and the verifier rejects a correct bridge. The probe now anchors to the first instruction followed by a coordinate gap larger than one byte, so the probed coordinate is strictly inside an instruction on either prologue encoding. Related to the conformance work in #31 / #341.

Problem and expected behavior

Smallest trigger: npm run verify:hopper:linux with fixtures compiled by a gcc that does not default to -fcf-protection (reproduced on Kali rolling, gcc 16.2.0, where rea_entry compiles to push rbp at 0x4011b6 followed by mov rbp,rsp at 0x4011b7).

Violated invariant: the navigation contract probe must exercise an interior (non-boundary) coordinate. With a one-byte first instruction, goto_address(anchor + 1) legitimately returns anchor + 1, and the run fails at scripts/lib/real-hopper-navigation.mjs (goto_address observed 0x4011b7, expected 0x4011b6) even though the bridge, contract text ("Interior coordinates snap to the containing analyzed object's start"), and cursor behavior are all correct.

Change and scope

verifyNavigation now walks the instruction coordinates to the first instruction whose successor coordinate is more than one byte away, then derives goto_address snap, current_address, next_address, prev_address, and post-rejection cursor assertions from that instruction. When the first instruction is multi-byte (the endbr64 encoding used by the CI target hosts), anchor stays 0 and every assertion is identical to the previous ones. Nothing outside scripts/lib/real-hopper-navigation.mjs changes; bridge, contracts, fixtures, and oracles are untouched. Intentionally not included: the same + 1 interior-coordinate pattern in scripts/lib/real-ghidra-boundaries.mjs (inspect_native_instruction not-instruction-boundary probe) is not changed here because I could not execute that lane end to end; flagging it for a maintainer decision instead.

Contract and boundary impact

  • Semantic owner and earliest changed stage: verifier script only (scripts/lib/real-hopper-navigation.mjs); no runtime stage changes.
  • CLI and MCP/tool-catalog contract: none; the asserted contract semantics (interior snap, unmapped rejection, cursor readback) are unchanged.
  • Provider, bridge, target-format, or platform compatibility: improves verifier portability across host toolchain prologue encodings (with and without -fcf-protection); no provider or bridge change.
  • Evidence, artifact, provenance, or reconstruction contract: not applicable.
  • Process execution, authorization, cleanup, or containment impact: not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: not applicable.

Evidence and regression coverage

  • Tests added or updated: none; this lane has no mocked mirror of the navigation probe, and the real run is the executable evidence.
  • Base reproduction and other evidence: executed real-Hopper Linux demo runs on Kali rolling (glibc 2.43, node 24.19) with the pinned launcher (SHA256 0294ced141cc373468ee22d8343e7dac41980cb05a937994ca81c9f09afe7ded) driven through the private-Xvfb demo lane:
    • Base f085589: run fails at the goto_address interior assertion (0x4011b7 observed vs 0x4011b6 expected) with default-toolchain fixtures.
    • This change: the same run completes, exit 0, cleanShutdown: true, process lineage verified with zero retained descendants, unrelated-Hopper sentinel survived, 139-tool catalog parity, 171 successful and 63 rejected boundary-contract calls, all navigation/workflow/search flags true.
    • A/B prologue control: fixtures rebuilt with -fcf-protection=branch (endbr64 first instruction) complete identically on the same code, confirming the multi-byte path keeps the previous assertions.
  • User-visible CLI/MCP output: not applicable.

The real-Hopper navigation probe derived its interior coordinate as
anchor + 1, which assumes the fixture procedure's first instruction is
longer than one byte. Host toolchains without endbr64-style prologue
padding (Kali gcc 16, or any build with -fcf-protection=none) compile
rea_entry to start with the one-byte push rbp, so anchor + 1 is itself
an instruction boundary: goto_address correctly observes that boundary
and the boundary-contract run rejects a correct bridge.

Advance the probe to the first instruction followed by a coordinate gap
larger than one byte and derive the interior-coordinate assertions from
that instruction, so the probed coordinate is never an analyzed-object
boundary on either prologue encoding.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T13:32:04.311983Z 9373042 PR opened
ℹ️ 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.

@morluto
morluto merged commit bf934d5 into morluto:main Oct 9, 2026
22 checks passed
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
…orluto#1285)

The real-Hopper navigation probe derived its interior coordinate as
anchor + 1, which assumes the fixture procedure's first instruction is
longer than one byte. Host toolchains without endbr64-style prologue
padding (Kali gcc 16, or any build with -fcf-protection=none) compile
rea_entry to start with the one-byte push rbp, so anchor + 1 is itself
an instruction boundary: goto_address correctly observes that boundary
and the boundary-contract run rejects a correct bridge.

Advance the probe to the first instruction followed by a coordinate gap
larger than one byte and derive the interior-coordinate assertions from
that instruction, so the probed coordinate is never an analyzed-object
boundary on either prologue encoding.
@morluto

morluto commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Nice catch on the verifier’s anchor + 1 assumption, @BaaRai. Choosing the first genuinely multi-byte instruction keeps the interior-navigation probe meaningful when a toolchain drops endbr64 padding. Thanks for making that contract check portable across host builds.

@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added the provider: hopper Analysis provider / engine: hopper label Nov 23, 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 provider: hopper Analysis provider / engine: hopper

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants