Skip to content

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

@wkozaczuk

Description

@wkozaczuk

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions