Skip to content

[AUTOMATED] Walk each pointer definition once in the stack-store guard so one function cannot hang a run - #973

Merged
mahaloz merged 1 commit into
mainfrom
fix/hang952
Oct 8, 2026
Merged

mahaloz merged 1 commit into
mainfrom
fix/hang952

Conversation

@mahaloz

@mahaloz mahaloz commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Since #952, kuna decompile-all never finishes on angr-dev's MIPS ld.so.1 (big- and little-endian). It runs at 100% CPU with no output, and --max-fn-seconds does not stop it:

timeout 120 kuna decompile-all binaries/tests/mips/ld.so.1 --max-fn-seconds 60   # angr-dev binaries
# exit 124, no output; 2ab3b826b (before #952) finishes in 23 s

sub_d2f0 (and sub_d23c in the mipsel build) never completes.

Fix

  • The stackstoreguard walk back along a guarded STORE pointer's definitions (pointer_pieces, and the loop and choice tests beside it) remembers what each Varnode at each depth gave. These STORE pointers are built through a chain of nested MULTIEQUALs and additions; the walk visited every path, inside one heritage pass. It now visits each value once. The answer at a Varnode depends only on it and its depth, so the output is unchanged.
  • --max-fn-seconds was polled only at action and heritage-loop boundaries, which that walk never reached. The drive now also publishes its deadline (decompile_drive.rs (deadline_passed)). The walks give up once it has passed, the written-slot guard checks it before each address, and the drive checks it again after the final layout checks, so a function that runs past it becomes an error record. --max-fn-seconds 2 errors out sub_d2f0 after 2.5 s.

Tests

  • New tests/stages/kuna-pointerwalk-budget-mips.xml: sub_d2f0's bytes. Never finishes on main; about 7 s now.
  • New tests/stages/kuna-pointerwalk-memo.xml: a pointer through five 8-way switches (clang -O2) that resolves only after more than 4,096 values prints char v3[16], as on main.
  • decompile-all on 61 binaries (the 47 binaries [AUTOMATED] Keep a stack array read after an indexed store from seeing the value written before it #952 was measured on, and angr-dev's MIPS, PowerPC and ARM ld.so* / libc*; 58,467 functions) prints what main prints, except the two hung functions, which now print what 2ab3b82 printed. The mips64 builds do not load, and the PowerPC and ARM libcs run past 360 s on 2ab3b82 too.
  • Speed against main (decompile-all, min of 11, interleaved): total -0.35% (72.23 s -> 71.97 s) over gzip -O2 +3.60% (min of 5 re-run: +1.7%), kmod +1.30%, grep -O0 +0.69%, ls +0.01% and cp -O2 -1.82%. MIPS ld.so.1, which main never finishes, takes 24.2 s against 22.4 s on 2ab3b82 (min of 3).

Part of #890

🤖 Generated with Claude Code

https://claude.ai/code/session_019c7W9nMmArWipVaBuMCy39

@mahaloz mahaloz added the full-ci Run the full cargo workspace suite on this PR before merge (internal PRs skip it by default) label Oct 8, 2026
…d; let the watchdog stop it

Since #952, decompile-all on MIPS ld.so.1 never finished, with or without
--max-fn-seconds: the walk back along a guarded STORE pointer's definitions
(pointer_pieces, and the loop and choice tests beside it) visited every
path through a chain of nested MULTIEQUALs and additions, inside one
heritage pass, where the watchdog was never polled.

Each walk now remembers what every (Varnode, depth) gave, so it visits each
value once and answers exactly as before. The drive also publishes its
per-function deadline (decompile_drive::deadline_passed): the walks give up
once it has passed, the written-slot guard checks it before each address,
and the drive checks it again after the final layout checks, so such a
function becomes an error record.

New stages kuna-pointerwalk-budget-mips.xml (sub_d2f0 of the MIPS ld.so.1)
and kuna-pointerwalk-memo.xml (a pointer that resolves only past 4,096
values prints as main prints).

Part of #890

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019c7W9nMmArWipVaBuMCy39
@mahaloz mahaloz changed the title [AUTOMATED] Bound the stack-store guard's pointer walks so one function cannot hang a run [AUTOMATED] Walk each pointer definition once in the stack-store guard so one function cannot hang a run Oct 8, 2026
@mahaloz
mahaloz merged commit 1b09b63 into main Oct 8, 2026
9 checks passed
@mahaloz
mahaloz deleted the fix/hang952 branch October 8, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Run the full cargo workspace suite on this PR before merge (internal PRs skip it by default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant