shim: Use setarch instead of relying on linux32 link

On some distributions, `linux32` command is not readily available in the
default install. However, `setarch` is commonly available as part of the
`util-linux` packaging, so let's invoke `setarch` directly now without
relying on links.

Signed-off-by: Ikey Doherty <ikey.doherty@intel.com>
This commit is contained in:
Ikey Doherty
2019-01-01 14:16:51 +00:00
parent 9624bde1b9
commit fc9ae2e9c2
2 changed files with 11 additions and 15 deletions
+1 -1
View File
@@ -196,7 +196,7 @@ Currently this INI file supports three options. The root section in this INI fil
`force-32bit = $boolean`
If set to a true boolean value (yes/true/on), the shadowed Steam binary will
be run via the `linux32` command. This will force the `steam` process
be run via the `setarch linux32` command. This will force the `steam` process
and all children to believe they are running on a 32-bit system. This
may be useful for 64-bit games that are buggy only on 64-bit.
+10 -14
View File
@@ -26,12 +26,6 @@
#include "lsi.h"
#include "shim.h"
/**
* Required to force Steam into 32-bit detection mode, which is useful for
* recent issues like the CS:GO 64-bit update with huge FPS drops
*/
#define EMUL32BIN "linux32"
/**
* Audit path is used for the libintercept library to ensure Steam only uses the
* host SDL, etc.
@@ -343,22 +337,24 @@ bool shim_bootstrap()
static int shim_execute_internal(const char *command, int argc, char **argv, bool use_path)
{
bool is_x86_64;
const char *n_argv[argc + 3];
const char *n_argv[argc + 5];
const char *exec_command = NULL;
int i = 1;
int8_t off = 1;
int (*vfunc)(const char *, char *const argv[]) = NULL;
is_x86_64 = lsi_system_is_64bit();
memset(&n_argv, 0, sizeof(char *) * (argc + 3));
memset(&n_argv, 0, sizeof(char *) * (argc + 5));
/* If we're 64-bit and 32-bit is forced, proxy via linux32 */
/* If we're 64-bit and 32-bit is forced, proxy via setarch linux32 */
if (lsi_config.force_32 && is_x86_64) {
exec_command = EMUL32BIN;
n_argv[0] = EMUL32BIN;
n_argv[1] = command;
off = 2;
/* Use linux32 in the path */
exec_command = "setarch";
n_argv[0] = "setarch";
n_argv[1] = "linux32";
n_argv[2] = "--";
n_argv[3] = command;
off = 4;
/* Use setarch in the path */
vfunc = execvp;
} else {
/* Directly call lsi_exec_bin */