Skip to content

libMangoHud_shim.so exports extra symbols such as eh_hash_elf, __dlsym, get_proc_address #1667

@smcv

Description

@smcv

Describe the bug
libMangoHud_shim.so is a LD_PRELOAD module, so every symbol that it exports will "interpose" symbols of the same name in any other library, and be called instead of the other implementation.

It looks as though it is exporting more symbols than it strictly needs to, which risks crashes or other badness.

List relevant hardware/software information

  • Linux Distribution: anything recent, tested on Arch
  • MangoHud version: 0.8.1-1 or git dc30950
  • GPU: AMD Vega

To Reproduce
objdump -T -x /path/to/libMangoHud_shim.so

Expected behavior
Only the symbols that MangoHud is intentionally replacing are exported, namely those declared with CREATE_FWD_VOID or CREATE_FWD and hooked with ADD_HOOK:

  • glXSwapBuffers
  • eglGetDisplay
  • eglGetPlatformDisplay
  • eglSwapBuffers
  • glXSwapBuffersMscOML
  • glXGetProcAddress
  • glXGetProcAddressARB
  • eglGetProcAddress

plus any that are handled non-generically:

  • dlsym
  • (others?)

Actual behavior

These symbols are exported:

DYNAMIC SYMBOL TABLE:
...
0000000000006018 g    DO .bss   0000000000000008  Base        __dlsym
0000000000003aa0 g    DF .text  00000000000000ab  Base        dlsym
0000000000002810 g    DF .text  0000000000000059  Base        eh_hash_elf
0000000000003730 g    DF .text  000000000000008a  Base        real_dlsym
00000000000037c0 g    DF .text  000000000000004d  Base        glXSwapBuffers
00000000000029e0 g    DF .text  0000000000000041  Base        eh_hash_gnu
0000000000002f30 g    DF .text  0000000000000111  Base        eh_set_rel
0000000000003860 g    DF .text  0000000000000065  Base        eglGetPlatformDisplay
0000000000002610 g    DF .text  00000000000001aa  Base        eh_init_obj
0000000000003810 g    DF .text  0000000000000050  Base        eglGetDisplay
0000000000003b50 g    DF .text  0000000000000014  Base        get_proc_address
0000000000003b70 g    DF .text  000000000000008e  Base        eh_iterate_callback
0000000000003a50 g    DF .text  0000000000000050  Base        eglGetProcAddress
0000000000003920 g    DF .text  0000000000000081  Base        glXSwapBuffersMscOML
0000000000003a00 g    DF .text  0000000000000050  Base        glXGetProcAddressARB
0000000000002c70 g    DF .text  000000000000000a  Base        eh_iterate_sym
0000000000003590 g    DF .text  00000000000001a0  Base        real_dlopen
0000000000003050 g    DF .text  000000000000013a  Base        eh_iterate_rela_plt
0000000000002550 g    DF .text  000000000000004b  Base        eh_iterate_obj
00000000000025a0 g    DF .text  0000000000000066  Base        eh_check_addr
0000000000002e30 g    DF .text  00000000000000ff  Base        eh_set_rel_plt
0000000000002c80 g    DF .text  000000000000009a  Base        eh_find_next_dyn
0000000000003190 g    DF .text  000000000000012a  Base        eh_iterate_rel_plt
00000000000038d0 g    DF .text  000000000000004f  Base        eglSwapBuffers
00000000000032c0 g    DF .text  0000000000000121  Base        eh_iterate_rel
0000000000002bd0 g    DF .text  000000000000009a  Base        eh_find_sym
0000000000002870 g    DF .text  0000000000000164  Base        eh_find_sym_hash
00000000000039b0 g    DF .text  0000000000000050  Base        glXGetProcAddress
00000000000024e0 g    DF .text  000000000000006e  Base        eh_find_callback
0000000000002a30 g    DF .text  0000000000000192  Base        eh_find_sym_gnu_hash
0000000000002d20 g    DF .text  000000000000010f  Base        eh_set_rela_plt
00000000000027c0 g    DF .text  000000000000004b  Base        eh_find_obj
00000000000033f0 g    DF .text  000000000000000f  Base        eh_destroy_obj
0000000000006020 g    DO .bss   0000000000000008  Base        __dlopen

and could interpose in front of any game or library code that uses the same naming convention, potentially for an incompatible function.

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