Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken BlockNode in Function Graphs #4591

Open
RaghulPS32 opened this issue Apr 18, 2024 · 3 comments
Open

Broken BlockNode in Function Graphs #4591

RaghulPS32 opened this issue Apr 18, 2024 · 3 comments
Assignees
Labels
bug Something is broken

Comments

@RaghulPS32
Copy link

Description

I was accessing the function graph using angr, where I stumbled upon a issue, while traversing through a function graph I tried to access the successors of a BlockNode which raised a error. Cannot calculate successors for graphless node. Upon further debugging found the CodeNode object attribute self._graph to be None.

  • But surprisingly this issue seems to resolve itself when I serialize the project using AngrDB ( code attached below ) and load it back again.
  • Successor Access without DB Serialization Code:
import angr
binary = angr.Project("<path to binary>",auto_load_libs=False,load_debug_info=True)
binary.analyses.CFGFast(normalize=True)
main = binary.kb.functions['main']
block = [blk for blk in main.graph]
print(block[0].successors())
  • Output
BlockNode:  <BlockNode at 0x40119a (size 20)>
Graph:  None
Cannot calculate successors for graphless node
  • Successor Access with DB Serialization Code:
import angr
from angr.angrdb.db import AngrDB
binary  = angr.Project("<path to binary>",auto_load_libs=False,load_debug_info=True)
binary.analyses.CFGFast(normalize=True)
db = AngrDB(binary)
db.dump("binary.db")
new_db = AngrDB()
project = new_db.load("binary_db")
main = project.kb.functions['main']
block = [blk for blk in main.graph]
print(block[0].successors())
  • Output
BlockNode:  <BlockNode at 0x40119a (size 20)>
[<Function sub_401310 (0x401310)>, <BlockNode at 0x4011fe (size 20)>]
  • Binary used current-locale.out in findutils compiled in x86, clang-8. -O0

  • Environment Used:
    angr==9.2.96
    pyvex==9.2.96
    cle==9.2.96

Steps to reproduce the bug

Steps to recreate the bug:

  • Create a angr project of the attached binary
  • Generate CFGFast(normalize=True)
  • Use the code snippet in description
  • It should raise the Cannot calculate successors for graphless node

Environment

angr==9.2.96
pyvex==9.2.96
cle==9.2.96

Additional context

No response

@RaghulPS32 RaghulPS32 added bug Something is broken needs-triage Issue has yet to be looked at by a maintainer labels Apr 18, 2024
@ltfish ltfish removed the needs-triage Issue has yet to be looked at by a maintainer label Apr 19, 2024
@ltfish
Copy link
Member

ltfish commented Apr 19, 2024

Can you provide the binary for us to reproduce?

@RaghulPS32
Copy link
Author

RaghulPS32 commented Apr 20, 2024 via email

@ltfish
Copy link
Member

ltfish commented Apr 24, 2024

@RaghulPS32 I don't think the binary went through. Can you please send it to [email protected]?

@ltfish ltfish self-assigned this Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants