-
Notifications
You must be signed in to change notification settings - Fork 1
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
entryPoints
do not include dynamic symbols
#12
Labels
bug
Something isn't working
Comments
RyanGlScott
added a commit
to GaloisInc/elf-edit
that referenced
this issue
Feb 15, 2023
Just like `decodeHeaderSymtab` decodes the static function symbol table, `decodeHeaderDynsym` serves the same role for dynamic function symbol tables. The functionality of `decodeHeaderDynsym` largely overlaps with the niche that the `dynamicEntries`/`dynSymEntry` functions provide, so I have included a comparison to those functions in the Haddocks for `decodeHeaderDynsym`. This will be useful for eventual fixes for GaloisInc/macaw#277 and GaloisInc/macaw-loader#12.
RyanGlScott
added a commit
to GaloisInc/elf-edit
that referenced
this issue
Feb 23, 2023
Just like `decodeHeaderSymtab` decodes the static function symbol table, `decodeHeaderDynsym` serves the same role for dynamic function symbol tables. The functionality of `decodeHeaderDynsym` largely overlaps with the niche that the `dynamicEntries`/`dynSymEntry` functions provide, so I have included a comparison to those functions in the Haddocks for `decodeHeaderDynsym`. This will be useful for eventual fixes for GaloisInc/macaw#277 and GaloisInc/macaw-loader#12.
RyanGlScott
added a commit
that referenced
this issue
Feb 23, 2023
This: * Bumps the `elf-edit` submodule to bring in the changes from GaloisInc/elf-edit#34, which adds `decodeHeaderDynsym`. * Bumps the `macaw` submodule to bring in the changes from GaloisInc/macaw#320, which changes the ELF loader to always load dynamic function symbols. (Bumping the `macaw` submodule also requires bumping the `crucible`, `llvm-pretty`, and `semmc` submodules to adapt to recent changes.) * Modifies the code for X86-64, AArch32, and PPC to always include dynamic function symbols. Fixes #12.
RyanGlScott
added a commit
that referenced
this issue
Feb 25, 2023
This: * Bumps the `elf-edit` submodule to bring in the changes from GaloisInc/elf-edit#34, which adds `decodeHeaderDynsym`. * Bumps the `macaw` submodule to bring in the changes from GaloisInc/macaw#320, which changes the ELF loader to always load dynamic function symbols. (Bumping the `macaw` submodule also requires bumping the `crucible`, `llvm-pretty`, and `semmc` submodules to adapt to recent changes.) * Modifies the code for X86-64, AArch32, and PPC to always include dynamic function symbols. Fixes #12.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In this program:
If you compile it to a shared library and
strip
it:The assembly will look like this:
Note that there are two function entry points here, one for
getzero
(at address 0x1020) and another forgetone
(at address 0x102b).macaw-loader
, on the other hand, only discovers the entry point forgetzero
. This is due to a limitation in howentryPoints
is defined:macaw-loader/macaw-loader-x86/src/Data/Macaw/BinaryLoader/X86.hs
Lines 50 to 67 in 7e26fbe
This implementation uses
decodeHeaderSymtab
, which only consults the static symbol table. This happens to contain the address forgetzero
because it is the main entry point address for the shared library:However,
libgetone-stripped.so
also contains dynamic symbols:If the
entryPoints
function consulted the dynamic symbols, similarly to how it is done inmacaw
, it would be able to find the address forgetone
.This example uses x86, but it applies to AArch32 and PPC32 as well, which use identical implementations for
entryPoints
.The text was updated successfully, but these errors were encountered: