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

Workaround for Source 1 libtcmalloc_minimal.so.4 issues no longer works in Steam client beta #1361

Open
smcv opened this issue Oct 31, 2024 · 1 comment

Comments

@smcv
Copy link
Contributor

smcv commented Oct 31, 2024

Game information
A game affected by ValveSoftware/Source-1-Games#5043 (I tested Half-Life 2: Deathmatch and Fistful of Frags)

Distribution name and version where applicable
Probably any distro. I tested on Arch Linux

Flatpak info
Flatpak 1.15.10, default (Mesa) GL driver

Problem description
In the Steam client beta, this app's workaround for games based on the Source 1 engine no longer works.

The problem is that Source 1 games bundle a copy of libtcmalloc_minimal.so.4 which overrides some but not all memory allocation functions. If some other component such as the graphics driver happens to call into the new C++17 aligned new/delete entry points, then the game will crash with an error message similar to this:

src/tcmalloc.cc:278] Attempt to free invalid pointer 0xa657d00 

Until recently, this Flatpak app has been able to work around that issue by installing a LD_AUDIT module (the "shared library guard") and configuring it to refuse to load the game's bundled libtcmalloc_minimal.so.4, resulting in the game instead loading a newer copy of libtcmalloc_minimal.so.4 which is included in this Flatpak app.

However, the Steam client beta runs games in a Steam Linux Runtime 1.0 (scout) container by default, and that container does not have its own copy of libtcmalloc_minimal.so.4. This means that instead of sometimes crashing with Attempt to free invalid pointer, now the game will always crash, with message similar to:

shared-library-guard active for /home/desktop/SteamLibrary/steamapps/common/Fistful of Frags/sdk/hl2_linux
Blocked library /home/desktop/SteamLibrary/steamapps/common/Fistful of Frags/sdk/bin/libtcmalloc_minimal.so.4
/home/desktop/SteamLibrary/steamapps/common/Fistful of Frags/sdk/hl2_linux: error while loading shared libraries: libtcmalloc_minimal.so.4: cannot open shared object file: No such file or directory

You can disable the no-longer-working workaround by setting an affected game's Launch Options to SHARED_LIBRARY_GUARD_CONFIG=/dev/null %command%, but on my test system, that simply returns me to the Attempt to free invalid pointer error.

The ideal solution would be for the affected games to stop using this interposed malloc implementation, but they're rather old and minimally-maintained, so that isn't necessarily going to happen any time soon.

I'm thinking about other possible solutions.

Does this issue reproduce with native Steam
Not on my system. With native Steam, the game's bundled libtcmalloc_minimal.so.4 is loaded, but for whatever reason, ValveSoftware/Source-1-Games#5043 did not seem to be triggered.

@AsciiWolf
Copy link
Contributor

The workaround also hasn't worked in CS: Source for some time now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants