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

[Ghidra] BinExport should never export multiple functions at the same address #76

Open
cblichmann opened this issue May 28, 2021 · 7 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@cblichmann
Copy link
Member

When exporting the busybox binary from busybox_mips_ghidra_binexport.zip, the function _init at address 004028B0 is included twice in the flow_graph field, causing BinDiff to fail:

$ bindiff busybox_g.BinExport busybox_g.BinExport 
BinDiff 7 (@376216480, May 27 2021), (c)2004-2011 zynamics GmbH, (c)2011-2021 Google LLC.
Error: AttachFlowGraph: flow graph already attached 004028B0

The root cause is Ghidra not properly handling _init, but the BinExport extension should always output a valid .BinExport.

@cblichmann cblichmann added bug Something isn't working enhancement New feature or request labels May 28, 2021
@cblichmann
Copy link
Member Author

For reference: BinDiff b/153891410.

@nstarke
Copy link

nstarke commented Jun 6, 2021

FWIW this issue seems specific to MIPS binaries - I had the same problem with MIPS eCos images.

Is there any known work around for this? Thanks in advance

@cblichmann
Copy link
Member Author

Well, BinExport uses whatever the disassembler gives it. So on one hand, this should really be fixed in Ghidra, either by fixing its analysis/heuristics or manually by cleaning up the disassembly.
A small script that highlights duplicate functions should be easy enough to come up with for this.
On the other hand, like I already said above, BinExport should always produce a valid .BinExport file. So I will fix this in BinExport, too, at some point. But that likely means to just drop one duplicated functions. This may or may not be what you'd want, though, as we might drop the wrong one (and for BinExport there's no way to know which one is good).

@nstarke
Copy link

nstarke commented Jun 7, 2021

Thank you for taking the time to respond to my question. I appreciate it.

@janbbeck
Copy link

I just want to bump this with a little additional information:
I have the same problem with an ARM executable, so this is not restricted to MIPS

@janbbeck
Copy link

Oh, and I should point out that this happens when comparing 2 debug builds of closely related executables. Seems strange for Ghidra to get tripped up on that...

@Martmists-GH
Copy link

Encountered this same issue on AARCH64 binaries, still an issue on latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants