google / binexport

Export disassemblies into Protocol Buffers
Apache License 2.0
1.05k stars 206 forks source link

Ghidra does not set FlowGraph.Edge.is_back_edge used to indicate loops #131

Open mr-tz opened 6 months ago

mr-tz commented 6 months ago

I think this should happen in this function: https://github.com/google/binexport/blob/e5199d7303ed92a3eb34599c575fba0a48bb60b3/java/src/main/java/com/google/security/binexport/BinExport2Builder.java#L324

Related function for IDA: https://github.com/google/binexport/blob/e5199d7303ed92a3eb34599c575fba0a48bb60b3/binexport2_writer.cc#L372

mike-hunhoff commented 6 months ago

@cblichmann can you clarify what is responsible for setting back edges? My understanding is that the underlying disassembler (IDA, Ghidra, etc.) builds a flow graph from which BinExport core uses https://github.com/google/binexport/blob/main/function.h#L72 to calculate back edges? If my understanding is correct, then it may be that the Ghidra extension is not generating flow graphs correctly (or at least this would be a good place to start before digging into BinExport core).