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

Ignore ELF versioning table when object looks up symbols by name in itself (self-lookup) #1066

Closed
wkozaczuk opened this issue Dec 17, 2019 · 1 comment

Comments

@wkozaczuk
Copy link
Collaborator

wkozaczuk commented Dec 17, 2019

The commit enhanced dynamic linker to skip old symbols as stated by versioning table. Unfortunately, the relevant code does not take into account whether the old symbol is being looked up by the object itself.

This sentence from https://www.akkadia.org/drepper/symbol-versioning - "If the highest bit (bit 15) is set this is a hidden symbol which cannot be referenced from outside the object." - seems to indicate the old symbols should be visible to the object itself.

This, for example, causes newer libgcc_s.so to crash when running the INIT functions because they reference some old symbols which failed to get resolved during the relocation phase for the reason above. The initial patch to address the issue was sent to the group here but may need some adjustments.

It seems to be possible to hide/expose such old symbols using a "self-lookup" flag. The flag would be ON only for the cases where the symbol is being looked up using its index in the symbol table rather than its name. Specifically, these cases involve calls to symbol_module object::symbol(unsigned idx, bool ignore_missing) method which is made by:

  • bool object::arch_relocate_rela(u32 type, u32 sym, void *addr, Elf64_Sxword addend)
  • bool object::arch_relocate_jump_slot(u32 sym, void *addr, Elf64_Sxword addend, bool ignore_missing)
  • void* object::resolve_pltgot(unsigned index)
@wkozaczuk
Copy link
Collaborator Author

Fixed by b6654d0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant