Repository navigation
[AUTOMATED] Walk each pointer definition once in the stack-store guard so one function cannot hang a run - #973
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since #952,
kuna decompile-allnever finishes on angr-dev's MIPSld.so.1(big- and little-endian). It runs at 100% CPU with no output, and--max-fn-secondsdoes not stop it:sub_d2f0(andsub_d23cin the mipsel build) never completes.Fix
stackstoreguardwalk 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-secondswas 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 2errors outsub_d2f0after 2.5 s.Tests
tests/stages/kuna-pointerwalk-budget-mips.xml:sub_d2f0's bytes. Never finishes on main; about 7 s now.tests/stages/kuna-pointerwalk-memo.xml: a pointer through five 8-way switches (clang -O2) that resolves only after more than 4,096 values printschar v3[16], as on main.decompile-allon 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 ARMld.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.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%. MIPSld.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