From 79bcc52012acb27c940fbb84d5ca0fb54828a5e3 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 26 Jun 2025 14:05:42 +0200 Subject: [PATCH] Fix polyinstantiation preventing Xwayland to start Resolves: RHEL-91324 --- ...e-about-permissions-of-tmp-.X11-unix.patch | 31 +++++++++++++++++ ...ad-of-checking-permission-modes-for-.patch | 34 +++++++++++++++++++ mutter.spec | 4 +++ 3 files changed, 69 insertions(+) create mode 100644 0001-Be-more-verbose-about-permissions-of-tmp-.X11-unix.patch create mode 100644 0002-Use-access-instead-of-checking-permission-modes-for-.patch diff --git a/0001-Be-more-verbose-about-permissions-of-tmp-.X11-unix.patch b/0001-Be-more-verbose-about-permissions-of-tmp-.X11-unix.patch new file mode 100644 index 0000000..8c07212 --- /dev/null +++ b/0001-Be-more-verbose-about-permissions-of-tmp-.X11-unix.patch @@ -0,0 +1,31 @@ +From 26abcb62d4838774956cebaa66465d56e7375904 Mon Sep 17 00:00:00 2001 +From: Nathan Pratta Teodosio +Date: Thu, 29 Aug 2024 09:25:13 +0200 +Subject: [PATCH 1/2] Be more verbose about permissions of /tmp/{,.X11-unix}. + +Part-of: +(cherry picked from commit 4dbaa8178116649076bf542a5eaf42d4ce804e5b) +--- + src/wayland/meta-xwayland.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c +index e405161c1d..98c0d502f5 100644 +--- a/src/wayland/meta-xwayland.c ++++ b/src/wayland/meta-xwayland.c +@@ -545,8 +545,10 @@ ensure_x11_unix_perms (GError **error) + if (x11_tmp.st_uid != tmp.st_uid && x11_tmp.st_uid != getuid ()) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, +- "Wrong ownership for directory \"%s\"", +- X11_TMP_UNIX_DIR); ++ "Wrong ownership for directory \"%s\", owned by %d but " ++ "should be same as %s (owned by (%d)) or %d", ++ X11_TMP_UNIX_DIR, x11_tmp.st_uid, TMP_UNIX_DIR, tmp.st_uid, ++ getuid ()); + return FALSE; + } + +-- +2.50.0 + diff --git a/0002-Use-access-instead-of-checking-permission-modes-for-.patch b/0002-Use-access-instead-of-checking-permission-modes-for-.patch new file mode 100644 index 0000000..8feec21 --- /dev/null +++ b/0002-Use-access-instead-of-checking-permission-modes-for-.patch @@ -0,0 +1,34 @@ +From d879589372a7857e1314773ff033ae54060f5648 Mon Sep 17 00:00:00 2001 +From: Nathan Pratta Teodosio +Date: Fri, 13 Jun 2025 11:24:24 +0200 +Subject: [PATCH 2/2] Use 'access' instead of checking permission modes for + /tmp/.X11-unix/. + +The previous version was missing the 200 case with the directory owned by the +current user. + +C.f. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7857, + https://launchpad.net/bugs/2069564. + +Part-of: +(cherry picked from commit 36ca36b48e7efd6846fac7533a4f2e97959a8ad6) +--- + src/wayland/meta-xwayland.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c +index 98c0d502f5..a7d273e53c 100644 +--- a/src/wayland/meta-xwayland.c ++++ b/src/wayland/meta-xwayland.c +@@ -553,7 +553,7 @@ ensure_x11_unix_perms (GError **error) + } + + /* ... be writable ... */ +- if ((x11_tmp.st_mode & 0022) != 0022) ++ if (access (X11_TMP_UNIX_DIR, W_OK) != 0) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, + "Directory \"%s\" is not writable", +-- +2.50.0 + diff --git a/mutter.spec b/mutter.spec index a4910a7..a35e1dc 100644 --- a/mutter.spec +++ b/mutter.spec @@ -94,6 +94,10 @@ Patch: 0003-tests-Add-drm-lease-test-for-non-non-desktop-hotplug.patch Patch: 0004-output-Add-pause-resume-signals.patch Patch: 0005-drm-lease-Treat-connectors-as-unleasable-when-inacti.patch +# Backport 'Write access checks for /tmp/.X11-unix/' (RHEL-91324) +Patch: 0001-Be-more-verbose-about-permissions-of-tmp-.X11-unix.patch +Patch: 0002-Use-access-instead-of-checking-permission-modes-for-.patch + BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.41.0 BuildRequires: pkgconfig(sm) BuildRequires: pkgconfig(libwacom)