Add an x86-64 object whose structured tree is deeper than a recursive walk - #220
Add an x86-64 object whose structured tree is deeper than a recursive walk#220zardus wants to merge 2 commits into
Conversation
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Validation record for head
Header fields read back with pyelftools:
session: sharpen |
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS The deepest structured tree the decompiler builds over the fixtures in Before — nothing in the repository reaches a depth that breaks a recursive walk: 652 objects, 28,468 functionsAfter — the new object is deeper than all of them and angr master cannot walk it: tests/x86_64/deeply_nested_ifsThe heights are the maximum nesting of |
… walk main is two hundred sequentially guarded statements over a value the compiler cannot fold away, so angr's structurer produces a ConditionNode wrapping a SequenceNode per level and the tree is 401 nodes deep. A walker that recurses per level runs out of interpreter frames on it.
915b3a7 to
8ee6b81
Compare
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
Problem
angr has no test input whose structured tree is deeper than a recursive walker can descend,
so a decompiler change that removes that limit cannot be regression tested. Decompiling
28,468 functions of 652 existing fixtures raises no
RecursionErrorat all; the deepesttree found is 306 levels, in
region_slice_targetoftests/aarch64/decompiler/pathological_loop, and that shape costs fewer interpreter framesper level so it decompiles cleanly.
Root cause
Real functions that reach the depth come from binaries that cannot be redistributed.
This object is generated from source instead.
Fix
tests/x86_64/deeply_nested_ifsis two hundred sequentially guarded statements over avalue the compiler cannot fold away, so the structurer produces a ConditionNode wrapping
a SequenceNode per level and the tree is about four hundred nodes deep. Built with
gcc -O0 -no-pie(GCC 15.3.0) fromtests_src/deeply_nested_ifs.c, which is committedbeside it, 15,584 bytes, sha256
ff00d14378eaeedb543c6f30685aa26718a3633a2fa3a533407caabc0b633411.Testing
angr.Project(...); CFGFast(); Decompiler(main)records aRecursionErrorand produces nooutput on angr master -- 997 traceback frames, 789 of them in
sequence_walker.py-- andproduces 809 lines with no errors on the branch that consumes it. The decompilation takes
under five seconds. Validation: #220 (comment)
session: sharpen