Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
948 stars 213 forks source link

GCC/Clang RTTI analysis #3857

Open cvscade opened 1 year ago

cvscade commented 1 year ago

GCC/Clang RTTI analysis RTTI support for the Itanium ABI

Is your feature request related to a problem? No

Are any alternative solutions acceptable? There is a plugin (Itanium C++ ABI by whitequark) but it's buggy and the version in the plugin manager hasn't been updated since 2020. The plugin's repository is pretty much dead.

0xdevalias commented 7 months ago

I'm not 100%, so correct me if i'm wrong, but I believe this may be related to automatically creating the structs for vtable_for_* and typeinfo_for_* and similar?

If so, I was wondering why this didn't seem to currently be a thing, I first found myself at this issue (due to the empty structs not being visible in the types):

And then found the following blog series, which helped me understand the in-memory layout of the vtables/etc in clang binaries a lot better:

Or for something way more low-level:

This may also be of interest:

As well as the existing vtable docs:

It would be awesome if Binary Ninja core was able to handle this automagically!


Also, since they don't seem to be cross-linked currently, here is the issue for MSVC for easier findability:

patacca commented 5 days ago

Just saying that there is a plugin here https://github.com/patacca/skald that I started to address the issue. It just recovers RTTI for the time being but in the future I'd like to fully recover the vtables and the in-memory layout of the objects, as well as auto-typing the variables with the corresponding types. All of this without relying on ELF symbols. I am starting it for Itanium ABI but ARM ABI should be the next step as it is not too different. If someone wants to help me we could speed up the things