From 2debb5f4c0c1b0e4900b7ceb4d8657ee68b2cec5 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Fri, 19 Apr 2024 16:35:02 +0100 Subject: [PATCH] FlatpakExports: Modify to use pressure-vessel's list of reserved paths pressure-vessel reserves more paths than Flatpak does, and we need to avoid all of them. For most of the code paths that set up exports, we will avoid the paths anyway (in order to log warnings), but as a fallback, it would be good to be sure that every possible reason for paths to be exported is covered. steamrt/tasks#434 Helps: https://github.com/ValveSoftware/steam-for-linux/issues/10789 Signed-off-by: Simon McVittie <smcv@collabora.com> --- pressure-vessel/flatpak-exports.c | 13 +++++++++---- pressure-vessel/wrap-context.c | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pressure-vessel/flatpak-exports.c b/pressure-vessel/flatpak-exports.c index 84e7bb264..c3af3a1c5 100644 --- a/pressure-vessel/flatpak-exports.c +++ b/pressure-vessel/flatpak-exports.c @@ -55,6 +55,9 @@ #include "flatpak-utils-private.h" #include "flatpak-error.h" +/* pressure-vessel-specific */ +#include "pressure-vessel/utils.h" + /* To keep this more similar to the original file, we explicitly disable * these warnings rather than fixing them */ #if defined(__GNUC__) && __GNUC__ >= 8 @@ -67,8 +70,6 @@ flatpak_abs_usrmerged_dirs get the same treatment without having to be listed here. */ const char *dont_export_in[] = { - /* This first line is pressure-vessel-specific */ - "/overrides", "/run/pressure-vessel", "/var/pressure-vessel", /* * pressure-vessel-specific note: * When merging from Flatpak, make sure any new paths here are copied @@ -891,6 +892,7 @@ _exports_path_expose (FlatpakExports *exports, int level) { g_autofree char *canonical = NULL; + const char * const *pv_reserved_paths; struct stat st; struct statfs stfs; char *slash; @@ -961,12 +963,15 @@ _exports_path_expose (FlatpakExports *exports, /* Syntactic canonicalization only, no need to use host_fd */ path = canonical = flatpak_canonicalize_filename (path); - for (i = 0; dont_export_in[i] != NULL; i++) + /* pressure-vessel-specific: Use a longer list of reserved paths */ + pv_reserved_paths = pv_get_reserved_paths (); + + for (i = 0; pv_reserved_paths[i] != NULL; i++) { /* Don't expose files in non-mounted dirs like /app or /usr, as they are not the same as on the host, and we generally can't create the parents for them anyway */ - if (flatpak_has_path_prefix (path, dont_export_in[i])) + if (flatpak_has_path_prefix (path, pv_reserved_paths[i])) { g_debug ("skipping export for path %s in unsupported prefix", path); return FALSE; diff --git a/pressure-vessel/wrap-context.c b/pressure-vessel/wrap-context.c index 7ba851d6e..112175829 100644 --- a/pressure-vessel/wrap-context.c +++ b/pressure-vessel/wrap-context.c @@ -8,6 +8,7 @@ #include "steam-runtime-tools/glib-backports-internal.h" #include "steam-runtime-tools/utils-internal.h" +#include "pressure-vessel/utils.h" static Tristate tristate_environment (const gchar *name) -- GitLab