View Single Post
Old 11-18-2019, 05:13 AM   #398
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,880
Default

REAPER crashes on exit if an extension linked against libcrypto (OpenSSL) fails to load due to missing versioned symbols in libstdc++. Or at least, these are the minimal conditions I found that duplicates the issue.

1. Compile the following extension with GCC 9 (to require libstdc++ 3.4.26 symbols for stringstream's constructor). I used Arch Linux's GCC 9.2.0 for testing.

https://cfillion.ca/files/reaper/rea...ash-on-exit.so

Code:
// gcc -fPIC -shared crash-on-exit.cpp -lstdc++ -lcrypto -o reaper_crash-on-exit.so

#include <sstream>

extern "C" int ReaperPluginEntry(void *, void *)
{
  std::stringstream ss;
  return 0;
}
2. Launch REAPER on Ubuntu 18.04, whose libstdc++ only has 3.4.25 symbols, and the extension fails to load as expected.
Code:
swell: dlopen() failed: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/cfillion/.config/REAPER/UserPlugins/reaper_crash-on-exit.so)
Error loading /home/cfillion/.config/REAPER/UserPlugins/reaper_crash-on-exit.so: (null)
3. It crashes after closing the main window (core dump here).
Code:
Thread 4 "reaper/mediaafx" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffdbd48700 (LWP 22734)]
0x00007ffff7de1ac8 in elf_machine_rela (skip_ifunc=0, reloc_addr_arg=0x7fffdd2abd00, version=0x30, 
    sym=0x7fffdce07af0, reloc=0x7fffdce62580, map=0x1bce220) at ../sysdeps/x86_64/dl-machine.h:308
308	../sysdeps/x86_64/dl-machine.h: No such file or directory.
(gdb) bt
#0  0x00007ffff7de1ac8 in elf_machine_rela (skip_ifunc=0, reloc_addr_arg=0x7fffdd2abd00, version=0x30, sym=0x7fffdce07af0, reloc=0x7fffdce62580, map=0x1bce220) at ../sysdeps/x86_64/dl-machine.h:308
#1  0x00007ffff7de1ac8 in elf_dynamic_do_Rela (skip_ifunc=0, lazy=<optimized out>, nrelative=<optimized out>, relsize=<optimized out>, reladdr=<optimized out>, map=0x1bce220) at do-rel.h:137
#2  0x00007ffff7de1ac8 in _dl_relocate_object (scope=<optimized out>, reloc_mode=reloc_mode@entry=0, consider_profiling=<optimized out>, consider_profiling@entry=0) at dl-reloc.c:258
#3  0x00007ffff7dea0bd in dl_open_worker (a=a@entry=0x7fffdbd47c00) at dl-open.c:382
#4  0x00007ffff6ae22df in __GI__dl_catch_exception (exception=0x7fffdbd47be0, operate=0x7ffff7de9dc0 <dl_open_worker>, args=0x7fffdbd47c00) at dl-error-skeleton.c:196
#5  0x00007ffff7de97ca in _dl_open (file=0x7ffff7bcabc0 "libgcc_s.so.1", mode=-2147483646, caller_dlopen=0x7ffff7bc8deb <pthread_cancel_init+43>, nsid=<optimized out>, argc=1, argv=<optimized out>, env=0x7fffffffe088) at dl-open.c:605
#6  0x00007ffff6ae13ad in do_dlopen (ptr=ptr@entry=0x7fffdbd47e30) at dl-libc.c:96
#7  0x00007ffff6ae22df in __GI__dl_catch_exception (exception=exception@entry=0x7fffdbd47dd0, operate=operate@entry=0x7ffff6ae1370 <do_dlopen>, args=args@entry=0x7fffdbd47e30) at dl-error-skeleton.c:196
#8  0x00007ffff6ae236f in __GI__dl_catch_error (objname=objname@entry=0x7fffdbd47e20, errstring=errstring@entry=0x7fffdbd47e28, mallocedp=mallocedp@entry=0x7fffdbd47e1f, operate=operate@entry=0x7ffff6ae1370 <do_dlopen>, args=args@entry=0x7fffdbd47e30) at dl-error-skeleton.c:215
#9  0x00007ffff6ae14d9 in dlerror_run (args=0x7fffdbd47e30, operate=0x7ffff6ae1370 <do_dlopen>) at dl-libc.c:46
#10 0x00007ffff6ae14d9 in __GI___libc_dlopen_mode (name=name@entry=0x7ffff7bcabc0 "libgcc_s.so.1", mode=mode@entry=-2147483646) at dl-libc.c:195
#11 0x00007ffff7bc8deb in pthread_cancel_init () at ../sysdeps/nptl/unwind-forcedunwind.c:52
#12 0x00007ffff7bc8fd4 in _Unwind_ForcedUnwind (exc=0x7fffdbd48d70, stop=0x7ffff7bc6d80 <unwind_stop>, stop_argument=0x7fffdbd47f10) at ../sysdeps/nptl/unwind-forcedunwind.c:126
#13 0x00007ffff7bc6f10 in __GI___pthread_unwind (buf=<optimized out>) at unwind.c:121
#14 0x00007ffff7bbeae5 in __do_cancel () at pthreadP.h:297
#15 0x00007ffff7bbeae5 in __pthread_exit (value=value@entry=0x0) at pthread_exit.c:28
#16 0x00007ffff64e1b71 in __threadproc(void*) (parm=0x16d6e10) at swell.cpp:455
#17 0x00007ffff7bbd6db in start_thread (arg=0x7fffdbd48700) at pthread_create.c:463
#18 0x00007ffff6a9c88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No crashes if the extension failed to load because of regular unresolved symbols, missing libraries or if it was not linked against libcrypto.

Last edited by cfillion; 11-18-2019 at 09:01 AM.
cfillion is online now   Reply With Quote