From a61e22d677fa9e28206c5de1a7a061a952a2bec7 Mon Sep 17 00:00:00 2001 From: Ikey Doherty Date: Tue, 10 Oct 2017 22:31:25 +0100 Subject: [PATCH] shim: When using native runtime, load liblsi-intercept in LD_AUDIT liblsi-intercept has a simple job of stopping Steam from trying to replace all of the system libraries in a mish-mash approach. Even when we have STEAM_RUNTIME=0, and even with the advent of the new "prefer host libraries" system, the internal replacements and pinning system actually break massively. To counteract this issue, we use our own rtld-audit implementation when launching the real Steam, which will severely restrict which libraries the main Steam binaries are actually allowed to load. This is on a whitelist basis and ensures that the host libraries will be used where appropriate, i.e. SDL, X11, etc. This prevents compatibility issues as well as the random crashes we're now seeing with Steam beta. Signed-off-by: Ikey Doherty --- src/shim/shim.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/shim/shim.c b/src/shim/shim.c index a1b73f3..a5ff6cd 100644 --- a/src/shim/shim.c +++ b/src/shim/shim.c @@ -26,6 +26,12 @@ */ #define EMUL32BIN "linux32" +/** + * Audit path is used for the libintercept library to ensure Steam only uses the + * host SDL, etc. + */ +#define AUDIT_PATH "/usr/\$LIB/liblsi-intercept.so" + int main(int argc, char **argv) { LsiConfig config = { 0 }; @@ -59,6 +65,7 @@ int main(int argc, char **argv) if (config.use_native_runtime) { /* Explicitly disable the runtime */ setenv("STEAM_RUNTIME", "0", 1); + setenv("LD_AUDIT", AUDIT_PATH, 1); } else { /* Only preload when needed. */ if (lsi_system_requires_preload()) {