Skip to content

Analysis: .back_edge miscomputed, preventing loop detection #2692

@lwerdna

Description

@lwerdna

Binary Ninja Version
2.4-dev

Describe the bug
The .back_edge field is not computed properly for a basic block.

To Reproduce
Steps to reproduce the behavior:

  1. open the attached busybox executable
  2. go to function sub_40a9e5
  3. execute the following commands in the python console:
>>> bbs[30]
<block: x86_64@0x40abdf-0x40abe8>
>>> bbs[30].outgoing_edges
[<UnconditionalBranch: x86_64@0x40aa9f>]
>>> bbs[30].outgoing_edges[0].back_edge
True
>>> bbs[15] in bbs[30].dominators
False

Expected behavior
A back edge B -> A is an edge where A dominates B. In other words, it's return a block that was previously executed (A) to get to the current position (B). Here b30 -> b15, but b15 is not a dominator of b30, so this should not be a back edge, yet it's reported as so.

Screenshots
Screen Shot 2021-10-11 at 5 47 10 PM

Version and Platform (required):

  • Binary Ninja: Dev 2.4
  • OS: macos

Additional context
This field is correct 99% of the time, tested on many basic blocks in many functions in busybox, so it could be pretty difficult to debug.

busybox-x86_64.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions