Skip to content
Snippets Groups Projects
Commit 3e4a3384 authored by Simon McVittie's avatar Simon McVittie
Browse files

runtime: Mask Vulkan layers in home directory or other non-/usr paths


This avoids the Steam fossilize and overlay layers being duplicated
in the container's search path.

Resolves: T26160
Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent f1ff7768
No related branches found
No related tags found
1 merge request!236Mask Vulkan layers in home directory or other non-/usr paths
Pipeline #8458 passed
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "libglnx/libglnx.h" #include "libglnx/libglnx.h"
#include <steam-runtime-tools/steam-runtime-tools.h> #include <steam-runtime-tools/steam-runtime-tools.h>
#include "steam-runtime-tools/graphics-internal.h"
#include "steam-runtime-tools/resolve-in-sysroot-internal.h" #include "steam-runtime-tools/resolve-in-sysroot-internal.h"
#include "steam-runtime-tools/utils-internal.h" #include "steam-runtime-tools/utils-internal.h"
...@@ -3954,6 +3956,48 @@ pv_runtime_bind (PvRuntime *self, ...@@ -3954,6 +3956,48 @@ pv_runtime_bind (PvRuntime *self,
self->adverb_in_container = "/run/pressure-vessel/pv-from-host/bin/pressure-vessel-adverb"; self->adverb_in_container = "/run/pressure-vessel/pv-from-host/bin/pressure-vessel-adverb";
} }
if ((self->flags & PV_RUNTIME_FLAGS_IMPORT_VULKAN_LAYERS)
&& exports != NULL)
{
/* We have added our imported Vulkan layers to the search path,
* but we can't just remove ~/.local/share, etc. from the search
* path without breaking unrelated users of the XDG basedirs spec,
* such as .desktop files and icons. Mask any remaining Vulkan
* layers by mounting empty directories over the top. */
static const char * const layer_suffixes[] =
{
_SRT_GRAPHICS_EXPLICIT_VULKAN_LAYER_SUFFIX,
_SRT_GRAPHICS_IMPLICIT_VULKAN_LAYER_SUFFIX,
};
gsize i;
for (i = 0; i < G_N_ELEMENTS (layer_suffixes); i++)
{
g_auto(GStrv) search_path = NULL;
const char *suffix = layer_suffixes[i];
gsize j;
search_path = _srt_graphics_get_vulkan_search_paths ("/",
self->original_environ,
multiarch_tuples,
suffix);
for (j = 0; search_path != NULL && search_path[j] != NULL; j++)
{
const char *dir = search_path[j];
/* We are mounting our own runtime over /usr anyway, so
* ignore those */
if (flatpak_has_path_prefix (dir, "/usr"))
continue;
/* Otherwise, if the directory exists, mask it */
if (g_file_test (dir, G_FILE_TEST_IS_DIR))
flatpak_exports_add_path_tmpfs (exports, dir);
}
}
}
/* Some games detect that they have been run outside the Steam Runtime /* Some games detect that they have been run outside the Steam Runtime
* and try to re-run themselves via Steam. Trick them into thinking * and try to re-run themselves via Steam. Trick them into thinking
* they are in the LD_LIBRARY_PATH Steam Runtime. * they are in the LD_LIBRARY_PATH Steam Runtime.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment