Skip to content

[AUTOMATED] Isolate advisory return-transfer decode context - #1608

Merged
mahaloz merged 3 commits into
Noelo-Lab:mainfrom
thotypous:fix/realcs-analysis-context
Nov 16, 2026
Merged

mahaloz merged 3 commits into
Noelo-Lab:mainfrom
thotypous:fix/realcs-analysis-context

Conversation

@thotypous

@thotypous thotypous commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

[AUTOMATED]

Problem

Probing a rejected far jump changes how an unrelated x86 real-mode near call is decoded. Its pushed return IP changes from 0x8893 to 0x0103.

On unpatched main, apply only this PR's public regression test, leaving the decoder unchanged:

gh pr diff 1608 --repo Noelo-Lab/kuna | git apply --include=decompiler/crates/kuna-console/tests/verify_raw_image.rs
cargo test --manifest-path decompiler/Cargo.toml -p kuna-console --test integration ret_transfer_probes_do_not_change_another_functions_return_ip -- --nocapture

The test constructs the image from bytes: ea 00 01 79 18 at 0x100, and e8 0d 00 c3 at 0x18890. Before the fix:

assertion `left == right` failed: an advisory chain walk changed the caller's IP
  left: Some(259)
 right: Some(34963)

Fix

  • Isolate decode-context changes made by advisory RET-chain and raw-run probes; restore them on return or unwind.
  • Preserve context propagation within a probe and commits made by real flow decoding.

Tests

The regression preserves 0x8893 after both rejected probes, while a real far-transfer decode still changes it to 0x0103. All 23 raw-image/RET-chain tests pass. The 146-binary corpus comparison found no output changes across 28,850 functions.

thotypous and others added 2 commits November 16, 2026 16:39
- Roll back speculative context writes after RET-chain and raw-run probes.
- Preserve context propagation within each probe and normal flow decoding.
- Cover unrelated real-mode return IPs with the rejected-probe and real-transfer controls.
… covers

The private decode-context transaction also wraps the override-flow chain
extension and the funcboundflow entry/padding checks, which share the
out-of-band raw decoder with calltrampoline and callpopret.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0179iMKQeLQDThvbHGNoGw8h
@mahaloz

mahaloz commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

[AUTOMATED] Pushed 25d6cb6 on top of your head (docs only, +3/-1 in docs/spec/02-lift-and-flow.md): the new paragraph named only the trampoline decoder, but decode_raw_run also backs callpopret and the funcboundflow entry/padding checks, and chain_of also serves the override flow chain extension. Those are now covered by the same rollback, so the spec names them. No code change.

@mahaloz
mahaloz merged commit 41ecd62 into Noelo-Lab:main Nov 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants