Skip to content

analysis: conclude error(nonzero,...) wrappers no-return — stop decoding cold fall-through (decbench F2, DIV-16) - #126

Merged
mahaloz merged 4 commits into
mainfrom
feat/decbench-noreturn-error
Jul 5, 2026
Merged

mahaloz merged 4 commits into
mainfrom
feat/decbench-noreturn-error

Conversation

@mahaloz

@mahaloz mahaloz commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

decbench campaign F2 — the single highest-leverage remaining lever: it closes cases across both the angr-beats-kuna AND ghidra-beats-kuna pools.

Mechanism

glibc error(int status, ...) / error_at_line(...) call exit(status) and never return when status != 0 — but DO return for status == 0 — so error can't be a Known no-return. Yet an internal wrapper whose tail is call error(2,...) (GNU pfatal_with_name, and every die()-via-error helper) is unconditionally no-return. kuna treated such wrappers as returning, so at every caller it decoded the cold fall-through / next-function bytes as live code (diffutils diff::sip inflated 43→99 LOC, GED 347).

Fix: treat a tail call error/error_at_line as terminal iff the call site's first int-arg register (x86-64 SysV EDI/RDI = the int status) is a nonzero literal (MOV EDI,0x2). A zero status (XOR EDI,EDI) or any non-constant/unprovable status is rejected (conservative — a false positive would drop live caller code). Emits the existing NoReturnFact → the existing set_function_no_return seam; the existing fixpoint propagates to every caller, which then truncates at the wrapper call. This is the value-conditional slice of Ghidra's discovered-no-return analyzer, folded into the noreturn_propagate consumer.

Effect

  • diff::sip: 99 → ~43 LOC (Ghidra's shape), GED 347 → 0.
  • Also closes the ghidra-beats-kuna sshd_hostkey_sign / simple_flush_write family (see docs/decbench/triage-ghidra/).

Default & gating

Option noreturn_error, default ON (DIV-16), change_kind = correctness-fix, REMOVES CODE (the dead fall-through). Gated on the Listing (default-off) AND noreturn_propagate — a no-op otherwise — so every parity gate is byte-identical (the real-ELF Listing path only; the console/datatest harness never builds a Listing, so docs/baseline.json is untouched).

Scope: the error() slice only. Transitive custom fatal wrappers (sshfatal) and infinite-loop wrappers (archive_write_error) are a documented follow-up.

Gates (verified independently by the coordinator)

  • make test — 675/675 PARITY OK (byte-identical; docs/baseline.json untouched — Listing-gated)
  • make test-stages — regenerated + PARITY OK
  • make rust-test — green

(The implementing agent was stopped once its implementation was complete; the coordinator added the DIV-16 entry and re-ran all three gates before merge.)

🤖 Generated with Claude Code

https://claude.ai/code/session_018DV2MXxQAAWK7xLPBmsq9J

mahaloz and others added 4 commits July 5, 2026 04:25
…ing cold fall-through (decbench F2, DIV-16)

The value-conditional slice of Ghidra's discovered-no-return analyzer, folded into
the noreturn_propagate consumer. glibc error(int status, ...) / error_at_line(...)
call exit(status) and never return when status != 0 (but DO return for status == 0),
so error can't be a Known no-return — yet an internal wrapper whose tail is
call error(2,...) (GNU pfatal_with_name, every die()-via-error helper) is
unconditionally no-return. kuna treated such wrappers as returning and decoded the
cold fall-through / next-function bytes as live code at every caller (diff::sip
inflated 43->99 LOC, GED 347).

Fix: treat a tail call error/error_at_line as terminal iff the call site's first
int-arg register (x86-64 SysV EDI/RDI = int status) is a nonzero literal (MOV EDI,0x2);
zero (XOR EDI,EDI) or non-constant/unprovable status is rejected (conservative).
Emits the existing NoReturnFact -> set_function_no_return; the existing fixpoint
propagates to every caller. sip 99->~43 LOC (ghidra's shape), GED 347->0; also closes
the ghidra sshd_hostkey_sign / simple_flush_write family.

Option noreturn_error, default ON (DIV-16), correctness-fix, REMOVES CODE. Gated on
the Listing (default-off) AND noreturn_propagate — a no-op otherwise — so every parity
gate is byte-identical (real-ELF Listing path only). Scope: the error() slice only;
transitive/looping internal wrappers (sshfatal, archive_write_error) are a follow-up.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018DV2MXxQAAWK7xLPBmsq9J
…n-error

# Conflicts:
#	decompiler/crates/kuna-base/src/xml.rs
#	decompiler/crates/kuna-decomp/src/p0_knowledge/kuna_stages/tests.rs
#	decompiler/crates/kuna-decomp/tests/catalog_bytecompat.rs
#	docs/baseline-stages.json
#	tests/stages/kuna-catalog.xml
…icts after returndup #124 merge

Serial-merge resolution: returndup (#124) and noreturn_error both bump the shared
catalog/corpus counts. Final = base + returndup + noreturn_error: option count 70->71,
corpus 158->159, settables 71; noreturn_error is source_decompiler=ghidra /
change_kind=correctness-fix so it doesn't touch the angr(#6)/structure-recovery(#7)
counts, only use_when(#5)/change_kind(#9). catalog --check OK.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018DV2MXxQAAWK7xLPBmsq9J
…or the 71st option

Missed in the merge resolution — a non-conflicting assert that git auto-took from main.
71 options => 70 trailing commas (last row has none).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018DV2MXxQAAWK7xLPBmsq9J
@mahaloz
mahaloz merged commit a35f7c0 into main Jul 5, 2026
mahaloz added a commit that referenced this pull request Jul 5, 2026
…n_error

Per user directive, ship iteregion default-on (angr ITERegionConverter: assignment
diamond -> ?: ternary). 0/675 datatests change (byte-identical corpus even default-on —
no per-test opt-outs needed), speed -2.6%. Still a runtime choice: an explicit if/else
compiles to the SAME object code, so --option iteregion off reverts per function.

Merge resolution after returndup (#124) + noreturn_error (#126) landed on main:
- stages.toml: split the two [[settable]] blocks the naive union merged into one; iteregion
  default=on, returndup default=off.
- architecture.rs: default-on line (self.iteregion=true, DIV-17) + restored the option-apply
  match arm's closing the union merge dropped; seam copy already wired (seam.iteregion).
- count-tests: option count 70/71->72, corpus 158/159->160, settables 72, catalog JSON commas 71,
  kuna-catalog.xml #6 angr 27 / #7 structure-recovery 16 (iteregion is both) / #5/#9 max 80.
- action-list golden: iteregion re-inserted after dedupitetail in the oracle (0259), leaf count
  266->267, tail array; stage_catalog.json + baseline-stages regenerated.
- ghangr-iteregion.xml: pass 1 now explicitly 'option iteregion off' to pin the if/else baseline
  the default-on pass converts.

Gates: make test 675/675 PARITY OK (byte-identical), make test-stages 254/254 PARITY OK.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018DV2MXxQAAWK7xLPBmsq9J
@mahaloz
mahaloz deleted the feat/decbench-noreturn-error branch July 29, 2026 08:01
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.

1 participant