MaartenBaert / ssr

SimpleScreenRecorder, a screen recorder for Linux
http://www.maartenbaert.be/simplescreenrecorder/
GNU General Public License v3.0
2.49k stars 288 forks source link

GLInject stopped working after glibc upgrade #947

Closed ITA84 closed 2 years ago

ITA84 commented 2 years ago

After a system update (Archlinux) that upgraded glibc from 2.33 to 2.35, the OpenGL recording function stopped working: the Launch Now button didn't launch the injected program like before, nothing happened and no error messages were produced. By using the ssr-glinject command to launch the same program instead, the following error message is produced

[SSR-GLInject] Error: Can't get dlsym address!

The problem is in glinject/Hook.cpp:56, where it tries to find the addresses of the dlsym and dlvsym symbols in libdl.so, but starting from glibc 2.34, those were moved to libc.so, therefore this doesn't work anymore.

I've tried changing libdl.so to libc.so and it seems to work for me, but of course it needs to work for older glibc versions as well, and I don't really know how to patch this in correctly; it would be nice if this got fixed here or if someone made a patch.

Thank you

Creteil commented 2 years ago

Why not recompiling by yourself ?

ITA84 commented 2 years ago

^ I did recompile, and it did work for me, but it'd be nice to have a proper patch (if not a fix in the main repo) out so that distros can include it in their packages. It's fine if nobody patches this anyway

Creteil commented 2 years ago

I did recompile, and it did work for me

Just recompiling against new glibc or patched + recompiling against new glibc ?

ITA84 commented 2 years ago

Patched + recompiled (I just replaced the libdl.so symbols lookup with a libc.so lookup)

Creteil commented 2 years ago

Maybe you can add a « diff » file of your changes...

Like this, it was easy for another one to patch the source code and compile it for a distribution running glibc 2.35.

Probably a commit came and definitively fix this problem, but in the meantime...

MaartenBaert commented 2 years ago

This ended up being far more work than I expected - just replacing libdl with libc didn't work for me, it just caused the whole program to crash very early in the loading phase, which also made debugging very hard. I ended up completely rewriting the hooking mechanism (it is now based on PLTHook instead of ElfHacks). Can you give it another try?

ITA84 commented 2 years ago

It works for me now. Thank you so much for your hard work!

petterreinholdtsen commented 1 month ago

Thank you for the great work, indeed. I believe this is the issue also reported in https://bugs.debian.org/1040375, and was very happy to discover the fix in 83b8f9f5d9c9ab06152657e57f85b6f71954a6b9 .