- Aug 06, 2021
-
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Ludovico de Nittis authored
pv-runtime: Refactor how we deal with regenerating ld.so.cache Closes #74 See merge request !355
-
Simon McVittie authored
pressure-vessel: Remap preloadable modules better See merge request !337
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This is a bit complicated, because there are two reasonable things that people might use LD_PRELOAD for, and in this mode it's particularly important to distinguish between them. One is to inject arbitrary code, like MangoHud or fakeroot. In this case, we want to take the loadable module from the namespace in which the user initiated pv-wrap. We can do this the same way we deal with the ${LIB} and ${PLATFORM} dynamic string tokens: load it once per ABI, pass a separate option to pv-adverb for each one, and let pv-adverb recombine them. The other is to work around libraries not being loaded soon enough, like the way people sometimes use LD_PRELOAD="libpthread.so.0 libGL.so.1" to force an optirun library to be loaded. In this case, we absolutely do not want to import the host library of that name into the container unconditionally, because if we do, it will sabotage our careful efforts to get the correct instance of libpthread.so.0 to be chosen. In this case, assume that the user meant "take whatever libpthread.so.0 you would naturally load, and preload it into each executable". Resolves: https://github.com/ValveSoftware/steam-runtime/issues/435 Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
The PvRuntime already provides pv-wrap with a pre-configured pv-adverb command-line, so we can repurpose that to include the necessary command-line options to regenerate the ld.so.cache the way we want it. Resolves: #74 Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This partially resolves <https://github.com/ValveSoftware/steam-runtime/issues/435 >, for the case where MangoHud was built with `-Dld_libdir_abs=true`, as in the upstream `build.sh` or upstream binary releases. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
We need to do this as highest-priority, since it invalidates the cleverer reasoning that we should be applying to LIB and PLATFORM. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This doesn't make any practical difference yet, but it sets us up to be able to carry out finer-grained processing based on the loadable_flags. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
FlatpakExports isn't going to export relative paths anyway. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
In reality, we have a FlatpakExports if and only if we are not creating a Flatpak subsandbox. If a caller somehow passes in a FlatpakExports while creating a subsandbox, it's harmless to tell it what to export. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Most of this code can be shared between the Flatpak and non-Flatpak code paths, avoiding internal duplication. In future, we will also want to call into append_preload_internal() when we split up something like /usr/$LIB/mangohud/libMangoHud.so or /opt/plat-$PLATFORM/mypreload.so into a separate path per supported architecture: in such cases, we will still have to rewrite /usr into /run/host/usr, and add /opt/plat-*/mypreload.so to the FlatpakExports. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
We need to remap these into something that can be loaded successfully in the container, but we don't yet. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
PreloadModule is no longer used in pv-adverb, because we needed a different data structure there. Do a similar transformation here. This turns it inside out: instead of what's conceptually map<variable=LD_AUDIT or LD_PRELOAD, values=array<string>> we now have array<struct<variable=LD_AUDIT or LD_PRELOAD, string>> which is a bit easier to deal with in practice. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This has almost full branch coverage. We don't currently cover the case where STEAM_COMPAT_CLIENT_INSTALL_PATH is not set, but that's trivial anyway (we treat all paths as not matching it). Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
An entry in LD_PRELOAD may be a bare SONAME like "libMangoHud.so", or a path containing special tokens like "/usr/$LIB/libMangoHud.so", or a literal path. Only literal paths are going to physically exist on disk. For a path containing special tokens, we can still try to remap it, for example /usr/$LIB/libMangoHud.so to /run/host/usr/$LIB/libMangoHud.so. This is imperfect (if the host and container glibc disagree on the meaning of $LIB, then we won't load it correctly), but it's better than nothing. A subsequent commit will improve the handling of paths that contain special tokens. For a bare SONAME, we just pass it through as-is for now, as though it was a relative path. This is also imperfect, but better than nothing. Another reason to want to make this change is that it allows us to unit-test this function: it's difficult to make assertions about the behaviour of a function that touches areas of the filesystem that are not under the control of the unit tests. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This allows mock environment variables to be used during unit testing. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This reduces the size of wrap.c, which is something we should be careful to keep under control. It also allows us to unit-test this code. Code changes made while factoring this out: * `flatpak_subsandbox` and `opt_remove_game_overlay` go via flags * `adverb_preload_argv` becomes `argv` * `return` instead of `continue` since pv_wrap_append_preload() is only one loop iteration Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
runtime: When copying the runtime, generate a new /etc/ld.so.cache See merge request !338
-
This avoids relying on the LD_LIBRARY_PATH as a way to get the overridden libraries into place. Co-authored-by:
Simon McVittie <smcv@collabora.com> Signed-off-by:
Ludovico de Nittis <ludovico.denittis@collabora.com>
-
Simon McVittie authored
Revert "pressure-vessel: Add support for the env var STEAM_COMPAT_FLAGS" See merge request !351
-
Ludovico de Nittis authored
Flag most G_OPTION_ARG_CALLBACK options with G_OPTION_FLAG_FILENAME See merge request !354
-
- Aug 05, 2021
-
-
Simon McVittie authored
Otherwise pv-adverb will exit unsuccessfully when asked to lock a file in a non-UTF-8 directory. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
If the user's locale is not UTF-8, we want to pass all filenames through as arbitrary blobs of bytes in no particular encoding, rather than requiring them to be UTF-8. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Ludovico de Nittis authored
pv-unruntime: Split LD_PRELOAD on either colons or spaces See merge request !352
-
Ludovico de Nittis authored
pv-wrap, pv-launcher: Set a reasonable RLIMIT_NOFILE See merge request !353
-
Simon McVittie authored
We could inherit any RLIMIT_NOFILE from Steam or another caller, but we want to give games a predictable execution environment. If a game uses select(), allocates memory proportional to the soft limit on file descriptors, or loops for a number of iterations proportional to the soft limit on file descriptors (as we did prior to commit 97b5a8f6 "pressure-vessel: Let short-term subprocesses inherit non-CLOEXEC fds"), then file descriptors numerically greater than 1023 are going to be a problem. If the soft limit is more than 1024 (= FD_SETSIZE), reduce it to 1024 to avoid this. Conversely, if we're launched with a soft limit strictly less than 1024, let's try to raise it to 1024 if the hard limit allows that. Related to <https://github.com/ValveSoftware/steam-for-linux/issues/7970 >. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
- Aug 04, 2021
-
-
Simon McVittie authored
There's no point in giving it an option that it will just ignore. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
According to ld.so(8), either is equally valid for LD_PRELOAD (although note that LD_AUDIT only accepts colons). Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Ludovico de Nittis authored
pv-adverb: Improve LD_AUDIT, LD_PRELOAD handling See merge request !350
-
- Aug 03, 2021
-
-
Ludovico de Nittis authored
This reverts commit f32f230a. Since the steam-runtime PR #439 the STEAM_COMPAT_FLAGS options are now a responsibility of run.sh Signed-off-by:
Ludovico de Nittis <ludovico.denittis@collabora.com>
-
Simon McVittie authored
This will allow pv-wrap to translate a host `LD_PRELOAD` item like `/usr/$LIB/libMangoHud.so` into a pair of `--ld-preload` options, each looking like `--ld-preload=/usr/lib32/libMangoHud.so:abi=i386-linux-gnu`. The only character that cannot appear in a `LD_PRELOAD` path entry is `:`, so we're free to use that as our representation for extra options. Instead of just appending the ABI tuple, use a key/value notation so we can extend later if we need to. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
At the moment the only way for this to get populated is when we guess it for gameoverlayrenderer.so, but a future commit will add a way to set it explicitly on the command-line. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This restructuring will let us add fields to the struct in future, in particular for architecture-specific modules. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
We only have two elements and we're iterating over them linearly. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-