Skip to content

runtime: Fix path_visible_in_provider_namespace() check

Ludovico de Nittis requested to merge wip/denittis/issues213 into main

The check to ensure that the path had the prefix sbin was wrongly using the OR comparison instead of the AND.

This meant that path_visible_in_provider_namespace() was returning true for every path that was under a 4 characters long directory. E.g. home/[...] was unexpectedly considered to be visible in the provider namespace.

This check is used in pv_runtime_take_from_provider() to evaluate if a simple symlink would be enough or if instead the files should be copied in a directory that is visible from inside the container. Leading to possible unexpected dangling symlinks.


Fixes: steamrt/tasks#213

With this MR now the layers located in the home directory gets copied inside the container, instead of ending up as dangling symlinks. Additionally, even if the library path is just the base soname that points to a location from the LD_LIBRARY_PATH, pressure-vessel will correctly RO bind it and create a symlink for it. So there is no need to change that.

E.g.

$ ls -l /home/ryuzaki/.local/lib/libVkLayer_FROG_gamescope_wsi.so
-rwxr-xr-x 1 ryuzaki ryuzaki 3092024 Jan 25 14:40 /home/ryuzaki/.local/lib/libVkLayer_FROG_gamescope_wsi.so

$ cat /home/ryuzaki/.local/share/vulkan/implicit_layer.d/VkLayer_FROG_gamescope_wsi.x86_64.json
{
    "file_format_version" : "1.0.0",
    "layer" : {
      "library_path": "libVkLayer_FROG_gamescope_wsi.so",
    [...]
}

$ LD_LIBRARY_PATH=/home/ryuzaki/.local/lib steam

Then, when launching an SLR container we will find in its logs:

D: Exporting /home/ryuzaki/.local/lib/libVkLayer_FROG_gamescope_wsi.so because overrides/lib/x86_64-linux-gnu/libVkLayer_FROG_gamescope_wsi.so points to it

D: Exported directories:
D: --bind /home /home
D: --bind /home/ryuzaki /home/ryuzaki
D: --ro-bind /home/ryuzaki/.local/lib/libVkLayer_FROG_gamescope_wsi.so /home/ryuzaki/.local/lib/libVkLayer_FROG_gamescope_wsi.so

# And from an xterm inside the container
$ ldconfig -p | grep FROG
        libVkLayer_FROG_gamescope_wsi.so (libc6,x86-64) => /usr/lib/pressure-vessel/overrides/lib/x86_64-linux-gnu/libVkLayer_FROG_gamescope_wsi.so

Merge request reports

Loading