From d8cc2d35f30e05ff32d282380061bcacbe59fea0 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Thu, 21 May 2020 15:42:36 +0100 Subject: [PATCH] runtime: Really use the realpath() of the host ld.so flatpak_canonicalize_filename() only does a syntactic normalization, eliminating ./ and similar constructs; it does not resolve symbolic links. We need to use the realpath() of the 64-bit dynamic linker, because otherwise, when we start replacing the dynamic linker in the container with a symlink into /run/host, the host system might have a symlink /lib64/ld-linux-x86-64.so.2 pointing outside /lib64, for example to /lib/ld-linux-x86-64-2.30.so. Then we'd get: runtime's ld-linux-x86-64.so.2 -> /run/host/lib64/ld-linux-x86-64.so.2 -> /lib/ld-linux-x86-64-2.30.so -> does not necessarily exist inside container Signed-off-by: Simon McVittie <smcv@collabora.com> --- src/runtime.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/runtime.c b/src/runtime.c index e8adc50c7..cb719b133 100644 --- a/src/runtime.c +++ b/src/runtime.c @@ -1478,7 +1478,13 @@ pv_runtime_use_host_graphics_stack (PvRuntime *self, g_debug ("Making host ld.so visible in container"); - ld_so_in_host = flatpak_canonicalize_filename (arch->ld_so); + ld_so_in_host = realpath (arch->ld_so, NULL); + + if (ld_so_in_host == NULL) + return glnx_throw_errno_prefix (error, + "Unable to determine host path to %s", + arch->ld_so); + g_debug ("Host path: %s -> %s", arch->ld_so, ld_so_in_host); g_debug ("Container path: %s -> %s", arch->ld_so, ld_so_in_runtime); flatpak_bwrap_add_args (bwrap, -- GitLab