binaryninja-api icon indicating copy to clipboard operation
binaryninja-api copied to clipboard

Pointers from relocations

Open comex opened this issue 2 years ago • 1 comments

What is the feature you'd like to have? In a position-independent executable or shared library, pointers in data segments have corresponding dynamic relocations (or a similar construct depending on the format) so the dynamic linker knows to fix them up. Binary Ninja could read the relocations and automatically mark the corresponding bytes as being pointers.

Is your feature request related to a problem? Pointers in data segments often fail to be automatically identified.

Are any alternative solutions acceptable? Heuristic pointer analysis (#1189) would also help with pointers not being identified; it would be less reliable but wouldn't be limited to binaries with relocations.

comex avatar Aug 10 '22 07:08 comex

We do explicitly do this already. Perhaps we have some missing relocation handlers. Can you share a binary where this info is missing?

plafosse avatar Aug 10 '22 09:08 plafosse

I'm assuming here that we're just missing pointers due to #1189 as we do actually create pointers in data segments when one exists. You can check if some block of memory contains a relocation using the bv.relocation_ranges_at(here) to see if a relocation exists at the current cursor. If one does exist and there isn't a DataVariable at this location please re-open this issue and I will mark it as a bug instead of an enhancement. As of now I'm marking it as a dupe.

plafosse avatar Aug 29 '22 16:08 plafosse