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

wsh: fix a crash when a symbol can't be loaded #39

Merged
merged 1 commit into from
Nov 6, 2022

Commits on Oct 11, 2022

  1. wsh: fix a crash when a symbol can't be loaded

    In case a symbol can be loaded dlsym() returns NULL. This need to be
    handled instead of blindly passing the 0 address do dladdr(), otherwise
    that causes a crash:
    
    $ ./bin/wsh
    init
    WARNING: No binary loaded in memory. Try loadbin(). For help type help("loadbin").
    
    [SIGSEGV]       Read    0x19        (address not mapped to object)
            0x7f7edd231cb1    /lib/x86_64-linux-gnu/libc.so.6(+0x14fcb1)
            0x42017f52    ./bin/wsh(scan_syms+0x152)
            0x420183c8    ./bin/wsh(parse_link_map_dyn+0x58)
            0x4201c371    ./bin/wsh(wsh_run+0x61)
            0x4200ecba    ./bin/wsh(main+0x3a)
            0x7f7edd10520a    /lib/x86_64-linux-gnu/libc.so.6(+0x2320a)
            0x7f7edd1052bc    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x7c)
            0x4200ed0a    ./bin/wsh(_start+0x2a)
    Segmentation fault (core dumped)
    
    This is reproducible for instance when wsh has been built against glibc
    <= 2.33, but executed on glibc >= 2.34. This is due to the merge of
    libdl.so into libc.so, resulting in libdl.so only containing weak
    symbols. wsh then crashes when trying to dlsym the
    _ITM_deregisterTMCloneTable symbol.
    
    Rebuilding wcc against glibc >= 2.34 workarounds the problem as the
    resulting wsh binary is not linked against libdl.so anymore.
    aurel32 committed Oct 11, 2022
    Configuration menu
    Copy the full SHA
    85688ff View commit details
    Browse the repository at this point in the history