Bug#1040375: /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so: Segmentation fault when used with anything
[Bernhard Übelacker] > As far as I see the crash happens because it wants to print this message: > > 57 GLINJECT_PRINT("Error: Can't open libdl.so!"); > > But unfortunately libstdc++ seems not yet prepared to output the > error. Thank you very much for the analysis and links. I applied the upstream patch to the Debian package build, and it sure seem to fix the segfault. Will need to do some more testing, and will upload a fixed package later. -- Happy hacking Petter Reinholdtsen
Bug#1040375: /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so: Segmentation fault when used with anything
On Sat, 10 Feb 2024 11:01:54 +0100 Petter Reinholdtsen wrote: [Petter Reinholdtsen] > I do not use ssr much myself, and have not had time to test. I applied the upstream commit in git branch fix-1040375-glinject and tested it on Bookworm, but alas, the .so file still segfaults with a useless backtrace. I might have applied the commit incorrectly, as it did not apply without changes, but hope not. Perhaps someone who understand what is happening can have a look? -- Happy hacking Petter Reinholdtsen Hello, looking through some bugs about crashes I came to this one and found found it interesting. If a proper backtrace is still helping one can get one by using systemd-coredump. Another nice way to debug early startup is using rr debugger. (Plus the ability to debug back and forth.) As far as I see the crash happens because it wants to print this message: 57 GLINJECT_PRINT("Error: Can't open libdl.so!"); But unfortunately libstdc++ seems not yet prepared to output the error. (rr) bt #0 0x7fbf7ff2fd9a in std::basic_ostream >::sentry::sentry(std::basic_ostream >&) () from /lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x7fbf7ff3074c in std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long) () from /lib/x86_64-linux-gnu/libstdc++.so.6 #2 0x7fbf7ff30bdb in std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x7fbf805cef6f in InitGLInject () at ./glinject/Hook.cpp:57 #4 0x7fbf805cf13f in dlsym (handle=0x7fbf8060d2e0, symbol=0x7fbf80185f7a "pthread_create") at ./glinject/Hook.cpp:231 #5 0x7fbf80136dd7 in glvndSetupPthreads () at ../src/util/glvnd_pthread.c:452 #6 0x7fbf801351a9 in __glDispatchOnLoadInit () at ../src/GLdispatch/GLdispatch.c:174 #7 0x7fbf805de9ce in call_init (env=0x7ffeea4b1538, argv=0x7ffeea4b1528, argc=1, l=) at ./elf/dl-init.c:74 #8 call_init (l=, argc=1, argv=0x7ffeea4b1528, env=0x7ffeea4b1538) at ./elf/dl-init.c:26 #9 0x7fbf805deab4 in _dl_init (main_map=0x7fbf8060d2e0, argc=1, argv=0x7ffeea4b1528, env=0x7ffeea4b1538) at ./elf/dl-init.c:121 #10 0x7fbf805f4a70 in _dl_start_user () from /lib64/ld-linux-x86-64.so.2 #11 0x0001 in ?? () #12 0x7ffeea4b25ea in ?? () #13 0x in ?? () (rr) (For some reason with libstdc++6-dbgsym the backtrace gets less good.) I guess upstream discussed this issue here: https://github.com/MaartenBaert/ssr/issues/947 And a package built from `fix-1040375-glinject` did no longer show this crash to me. Attached file shows my actions inside a minimal bookworm VM. Kind regards, Bernhard # 2024-05-07 Bookworm/stable amd64 qemu VM apt update apt dist-upgrade apt install systemd-coredump mc gdb rr mesa-utils git simplescreenrecorder-lib simplescreenrecorder-lib-dbgsym libglvnd0-dbgsym libstdc++6-dbgsym appstream apt build-dep simplescreenrecorder-lib mkdir /home/benutzer/source/simplescreenrecorder/orig -p cd/home/benutzer/source/simplescreenrecorder/orig apt source simplescreenrecorder benutzer@debian:~$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so /usr/bin/true Speicherzugriffsfehler (Speicherabzug geschrieben) benutzer@debian:~$ benutzer@debian:~$ coredumpctl list Hint: You are currently not seeing messages from other users and the system. Users in groups 'adm', 'systemd-journal' can see all messages. Pass -q to turn off this notice. TIME PID UID GID SIG COREFILE EXESIZE Tue 2024-05-07 00:10:28 CEST 994 1000 1000 SIGSEGV present /usr/bin/true 89.0K benutzer@debian:~$ benutzer@debian:~$ coredumpctl gdb --debugger-argument=-q 994 Hint: You are currently not seeing messages from other users and the system. Users in groups 'adm', 'systemd-journal' can see all messages. Pass -q to turn off this notice. PID: 994 (true) UID: 1000 (benutzer) GID: 1000 (benutzer) Signal: 11 (SEGV) Timestamp: Tue 2024-05-07 00:10:28 CEST (1min 26s ago) Command Line: /usr/bin/true Executable: /usr/bin/true Control Group: /user.slice/user-1000.slice/session-3.scope Unit: session-3.scope Slice: user-1000.slice Session: 3 Owner UID: 1000 (benutzer) Boot ID: 4df23299079540e38e42560b3966b576 Machine ID: 55a5ad9df1d547f38d7696343d9fde7d Hostname: debian Storage: /var/lib/systemd/coredump/core.true.1000.4df23299079540e38e42560b3966b576.994.171503342800.zst (present) Size on Disk: 89.0K Message: Process 994 (true) of user 1000 dumped core. Stack trace of thread 994: #0 0x7f988d92fd9a _ZNSo6sentryC1ERSo (libstdc++.so.6 + 0x12fd9a) #1 0x7f988d93074c _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l (libstdc++.so.6 + 0x13074c)
Bug#1040375: /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so: Segmentation fault when used with anything
[Petter Reinholdtsen] > I do not use ssr much myself, and have not had time to test. I applied the upstream commit in git branch fix-1040375-glinject and tested it on Bookworm, but alas, the .so file still segfaults with a useless backtrace. I might have applied the commit incorrectly, as it did not apply without changes, but hope not. Perhaps someone who understand what is happening can have a look? -- Happy hacking Petter Reinholdtsen
Bug#1040375: /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so: Segmentation fault when used with anything
I had a look upstream, and found two issues that seem to be about this crash bug: https://github.com/MaartenBaert/ssr/issues/992 and https://github.com/MaartenBaert/ssr/issues/1013 . The latter have some patch proposals. If the latest upstream git edition work, could the fix be the change descrived as "Switch to PLT hooks to make GLInject work with new dlopen/dlsym in libc" in https://github.com/MaartenBaert/ssr/commit/83b8f9f5d9c9ab06152657e57f85b6f71954a6b9 >? I do not use ssr much myself, and have not had time to test. -- Happy hacking Petter Reinholdtsen
Bug#1040375: /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so: Segmentation fault when used with anything
I figured out a way to run this under valgrind: cp /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so . chmod a+rx libssr-glinject.so valgrind ./libssr-glinject.so This provide something semi-sensible from valgrind. No idea what the mapped region is, might have to build the library with debug information for this. Installing simplescreenrecorder-dbgsym and simplescreenrecorder-lib-dbgsym did not help to get more sensible information about where it crashes. Perhaps printf debugging is the only option? ==125603== Memcheck, a memory error detector ==125603== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==125603== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==125603== Command: ./libssr-glinject.so ==125603== ==125603== ==125603== Process terminating with default action of signal 11 (SIGSEGV) ==125603== Bad permissions for mapped region at address 0x108000 ==125603==at 0x108000: ??? (in /scratch/pere/src/opencamlib-salsa/libssr-glinject.so) ==125603== ==125603== HEAP SUMMARY: ==125603== in use at exit: 0 bytes in 0 blocks ==125603== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==125603== ==125603== All heap blocks were freed -- no leaks are possible ==125603== ==125603== For lists of detected and suppressed errors, rerun with: -s ==125603== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Segmentation fault (core dumped) -- Happy hacking Petter Reinholdtsen
Bug#1040375: /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so: Segmentation fault when used with anything
[B] > * What led up to the situation? > Trying to "Record OpenGL" in simplescreenrecorder. > * What exactly did you do (or not do) that was effective (or ineffective)? > LD_PRELOAD=/usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so > /usr/bin/true It is unclear to me why you believe this should work. Can you tell me where you got the idea to run the shared library like this? Note, I am able to reproduce the crash. I only use the package by starting simplescreenrecorder, so I have never seen the problem you are reporting before, and do not understand when it would occur in normal use. Can you explain? I tried running from valgrind, but it did not work. I get the segfault, but no information about where the segfault happen. valgrind --trace-children=yes dash -c "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so /usr/bin/true" Same problem with gdb: (gdb) set environment LD_PRELOAD /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so (gdb) run Starting program: /usr/bin/true During startup program terminated with signal SIGSEGV, Segmentation fault. (gdb) bt No stack. (gdb) I have no idea how to debug this. -- Happy hacking Petter Reinholdtsen
Bug#1040375: /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so: Segmentation fault when used with anything
Package: simplescreenrecorder-lib Version: 0.4.4-3 Severity: grave File: /usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so Justification: renders package unusable X-Debbugs-Cc: alanas...@mail.ru Dear Maintainer, * What led up to the situation? Trying to "Record OpenGL" in simplescreenrecorder. * What exactly did you do (or not do) that was effective (or ineffective)? LD_PRELOAD=/usr/lib/x86_64-linux-gnu/simplescreenrecorder/libssr-glinject.so /usr/bin/true * What was the outcome of this action? Segmentation fault * What outcome did you expect instead? /usr/bin/true exits with 0 status code. -- System Information: Debian Release: 12.0 APT prefers stable-security APT policy: (500, 'stable-security'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 6.1.0-9-amd64 (SMP w/4 CPU threads; PREEMPT) Kernel taint flags: TAINT_WARN Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages simplescreenrecorder-lib:amd64 depends on: ii libc6 2.36-9 ii libgcc-s1 12.2.0-14 ii libglu1-mesa [libglu1] 9.0.2-1.1 ii libopengl0 1.6.0-1 ii libstdc++6 12.2.0-14 ii libx11-62:1.8.4-2+deb12u1 ii libxfixes3 1:6.0.0-2 simplescreenrecorder-lib:amd64 recommends no packages. simplescreenrecorder-lib:amd64 suggests no packages. -- no debconf information