diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-02-06 23:26:24 -0500 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-02-24 09:22:54 -0500 |
commit | b9a4705f80e89fff3b65288cbbe8df73a365aee3 (patch) | |
tree | c5a84b910034203d8ec257701bcefd0b2c163a00 /gnu/packages/patches/webkitgtk-canonicalize-paths.patch | |
parent | 57d0b1afb25881b2fa94e541d0ca586595cca8b9 (diff) | |
download | guix-b9a4705f80e89fff3b65288cbbe8df73a365aee3.tar.gz |
gnu: webkitgtk: Adjust BubbleWrap wrapper.
This revisits <https://issues.guix.gnu.org/40837> with a fix that doesn't require to have PULSE_CLIENTCONFIG point to an absolute store location, which will allow us to revert to have PULSE_CLIENTCONFIG point to a fixed location under /etc. This would alleviate the need to reboot to have changes to the PulseAudio configuration effected. * gnu/packages/patches/webkitgtk-share-store.patch: Delete file. * gnu/packages/patches/webkitgtk-bubblewrap-paths.patch: Add file. * gnu/packages/patches/webkitgtk-canonicalize-paths.patch: Likewise. * gnu/local.mk (dist_patch_DATA): Update patches list. * gnu/packages/webkit.scm (webkitgtk)[patches]: Adjust accordingly.
Diffstat (limited to 'gnu/packages/patches/webkitgtk-canonicalize-paths.patch')
-rw-r--r-- | gnu/packages/patches/webkitgtk-canonicalize-paths.patch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/gnu/packages/patches/webkitgtk-canonicalize-paths.patch b/gnu/packages/patches/webkitgtk-canonicalize-paths.patch new file mode 100644 index 0000000000..741d534831 --- /dev/null +++ b/gnu/packages/patches/webkitgtk-canonicalize-paths.patch @@ -0,0 +1,66 @@ +Upstream commit: https://github.com/WebKit/WebKit/commit/6a87eb254ef57a986a1a6ce9a3a4b66928afeb65 + +diff --git a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp +index ecc804663784..a2a1c9d7a4dd 100644 +--- a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp ++++ b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp +@@ -27,7 +27,6 @@ + #include <seccomp.h> + #include <sys/ioctl.h> + #include <sys/mman.h> +-#include <unistd.h> + #include <wtf/FileSystem.h> + #include <wtf/UniStdExtras.h> + #include <wtf/glib/GRefPtr.h> +@@ -165,6 +164,15 @@ enum class BindFlags { + Device, + }; + ++static void bindSymlinksRealPath(Vector<CString>& args, const char* path, const char* bindOption = "--ro-bind") ++{ ++ WTF::String realPath = FileSystem::realPath(path); ++ if (path != realPath) { ++ CString rpath = realPath.utf8(); ++ args.appendVector(Vector<CString>({ bindOption, rpath.data(), rpath.data() })); ++ } ++} ++ + static void bindIfExists(Vector<CString>& args, const char* path, BindFlags bindFlags = BindFlags::ReadOnly) + { + if (!path || path[0] == '\0') +@@ -177,7 +185,16 @@ static void bindIfExists(Vector<CString>& args, const char* path, BindFlags bind + bindType = "--ro-bind-try"; + else + bindType = "--bind-try"; +- args.appendVector(Vector<CString>({ bindType, path, path })); ++ ++ // Canonicalize the source path, otherwise a symbolic link could ++ // point to a location outside of the namespace. ++ bindSymlinksRealPath(args, path, bindType); ++ ++ // As /etc is exposed wholesale, do not layer extraneous bind ++ // directives on top, which could fail in the presence of symbolic ++ // links. ++ if (!g_str_has_prefix(path, "/etc/")) ++ args.appendVector(Vector<CString>({ bindType, path, path })); + } + + static void bindDBusSession(Vector<CString>& args, bool allowPortals) +@@ -410,17 +427,6 @@ static void bindV4l(Vector<CString>& args) + })); + } + +-static void bindSymlinksRealPath(Vector<CString>& args, const char* path) +-{ +- char realPath[PATH_MAX]; +- +- if (realpath(path, realPath) && strcmp(path, realPath)) { +- args.appendVector(Vector<CString>({ +- "--ro-bind", realPath, realPath, +- })); +- } +-} +- + // Translate a libseccomp error code into an error message. libseccomp + // mostly returns negative errno values such as -ENOMEM, but some + // standard errno values are used for non-standard purposes where their |