google / binexport

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

Inconsistent BinDiff result using Ghidra BinExports generated on different machines #92

Open YashasAndaluri opened 2 years ago

YashasAndaluri commented 2 years ago

Hello

I'm trying to use Ghidra for generating BinExports for the diff and diff3 arm binaries. However, the BinDiff log result from these BinExports is not consistent when I generate the same pair of BinExports across different machines.

I'm using the Ghidra 9.2.3 release with the Ghidra extension provided with BinExport 12 release (for BinDiff 7) I have set up Ghidra on machines with jdk 12.0.2 and jdk 11.0.15

Difference in BinDiff output with both machines with jdk 12.0.2: diff-result-jdk12.txt

Difference in BinDiff output on machines with jdk 11.0.15 and jdk 12.0.2: diff-result-jdk11-12.txt

Any suggestions on this problem would really help.

Thanks

cblichmann commented 2 years ago

I can't look into this in a timely fashion, but I suspect this may have something to do with the order in which we export the functions from Ghidra. While the resulting BinExport should always store functions and basic blocks sorted by their address, iteration order during export may not be stable (Ghidra uses unordered maps under the hood, which may change between JDK versions). Although, when I read the above report again that does not explain the weird difference in diff-result-jdk12.txt... Can you maybe attach the BinExport pairs to this bug? If that is not possible, can you do a text dump using the binexport2dump tool for each of the 4 BinExports and send me the text-diff of "binaryA_machine1_jdk12.txt" and "binaryA_machine2_jdk12.txt` (and the other pair)?

Also, does this happen on newer versions of Ghidra, too?

YashasAndaluri commented 2 years ago

Thanks for the insights on Ghidra. Attaching the BinExport pairs: diff_binexports.zip

Attaching text diffs from binexport2dump as well: diff_machine1_machine2_jdk12.txt diff3_machine1_machine2_jdk12.txt

I have not yet tried using a newer version of Ghidra for generating the BinExports.