Skip to content

Operator new overloading causes shitfuck failure #20

@fruityloops1

Description

@fruityloops1

When you overload operator new (or delete, or sometimes malloc but not all the time because malloc is weird), the symbol will be force exported by whatever the shit ass linker being used is.

  • This causes any offsets to the function in the GOT/PLT to be overwritten with a pointer to a PLT wrapper that branches to the end of the .text section (text_end) before relocation, which should not matter usually but does here because JMPREL relocations are being used instead of RELA relocations which would overwrite the offset with a correct one built from the module base and offset in the RELA entry instead of the invalid offset that is now sitting in the PLT. (No clue why this happens or where it happens, but it can be observed when reading PLT values before runtime in GDB)
  • This causes the function to be viewed as an import by RTLD and will overwrite the PLT offsets with offsets to functions with the same symbol in other modules

This can be worked around by adding the affected symbols to a version script as "local" symbols, which prevents them from being exported. I don't expect you to fix this or know why it's happening, but just writing it down for the record

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions