google / binexport

Export disassemblies into Protocol Buffers
Apache License 2.0
1.03k stars 197 forks source link

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

Open mr-tz opened 4 months ago

mr-tz commented 4 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 4 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).