How to set default base address for custom elf architecture? #2460
-
Hey, I'm implementing an Architecture plugin for Binary Ninja. The binaries are standard elfs so I don't want to implement my own BinaryView. I registered my architecture with the elf BinaryViewType: I tried to set an callback which then calls BinaryView.rebase but that causes Binary Ninja to freeze.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
So there's two ways to go about doing this, presently: It should be possible to set this during load using load options to set the base address manually (see: "Image Base Address" option). Another more involved option would be to use a derived BinaryView. Essentially, you'd define a new BinaryViewType, but in the initialization method you'd call and create a normal ELF binaryview, change the segments/sections around to reflect what you want, then return that ELF view as if it was your own view. This would also require you to munge the ELF header in some way to make sure the file gets diverted to your own view instead. The issue with your current approach is just that the callback there isn't able to safely interact with the BinaryView object in that way. Longer term, this sort of thing should be helped along significantly by work such as #1977 which is being worked on presently. |
Beta Was this translation helpful? Give feedback.
So there's two ways to go about doing this, presently:
It should be possible to set this during load using load options to set the base address manually (see: "Image Base Address" option).
Another more involved option would be to use a derived BinaryView. Essentially, you'd define a new BinaryViewType, but in the initialization method you'd call and create a normal ELF binaryview, change the segments/sections around to reflect what you want, then return that ELF view as if it was your own view. This would also require you to munge the ELF header in some way to make sure the file gets diverted to your own view instead.
The issue with your current approach is just that the callback there is…