flathub / flathub/com.valvesoftware.Steam

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

Open
#1,361 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
421
Forks
78
PR merge metrics
No merged PRs in 30d

Description

**Game information**
A game affected by https://github.com/ValveSoftware/Source-1-Games/issues/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](https://airlied.blogspot.com/2023/04/fedora-38-llvm-vs-team-fortress-2-tf2.html). 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, https://github.com/ValveSoftware/Source-1-Games/issues/5043 did not seem to be triggered.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with an affected Source 1 game in the Steam client beta and the Steam Linux Runtime 1.0 (scout) container. Review the shared-library guard configuration and the documented SHARED_LIBRARY_GUARD_CONFIG=/dev/null launch option. Done means affected games launch without the missing-library error or the invalid-pointer crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.