[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1033670: marked as done (unblock: xwayland/2:22.1.9-1)



Your message dated Fri, 31 Mar 2023 11:59:06 +0000
with message-id <E1piDPO-00GoOn-7C@respighi.debian.org>
and subject line unblock xwayland
has caused the Debian Bug report #1033670,
regarding unblock: xwayland/2:22.1.9-1
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
1033670: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033670
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: jcristau@debian.org

Please unblock package xwayland

[ Reason ]
CVE-2023-1393

[ Risks ]
Arguably we could have cherry-picked just the CVE fix but the rest seems
reasonably low-risk too, so might as well throw in the extra fixes.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

[ Other info ]

Upstream changelog from 22.1.8 (currently in testing) follows.  All
changes are reasonably straightforward and self-contained.

> commit f44cdcf4660ff70ee0dc9dc1f07ea31f8548837e
> Author: Olivier Fourdan <ofourdan@redhat.com>
> Date:   Wed Mar 29 14:00:14 2023 +0200
> 
>     Bump version to 22.1.9
>     
>     Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
> 
>  meson.build | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> commit b3d05255dd1e8ece1636fb07b9461122273785ee
> Author: Olivier Fourdan <ofourdan@redhat.com>
> Date:   Mon Mar 13 11:08:47 2023 +0100
> 
>     composite: Fix use-after-free of the COW
>     
>     ZDI-CAN-19866/CVE-2023-1393
>     
>     If a client explicitly destroys the compositor overlay window (aka COW),
>     we would leave a dangling pointer to that window in the CompScreen
>     structure, which will trigger a use-after-free later.
>     
>     Make sure to clear the CompScreen pointer to the COW when the latter gets
>     destroyed explicitly by the client.
>     
>     This vulnerability was discovered by:
>     Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
>     
>     Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
>     Reviewed-by: Adam Jackson <ajax@redhat.com>
>     (cherry picked from commit 26ef545b3502f61ca722a7a3373507e88ef64110)
> 
>  composite/compwindow.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> commit 809cbedb969f10754ef866f71395c7b89968b2d5
> Author: Benno Schulenberg <bensberg@telfort.nl>
> Date:   Mon Mar 27 20:03:56 2023 +0200
> 
>     xkbUtils: use existing symbol names instead of deleted deprecated ones
>     
>     Symbols `XK_Cyrillic_DZHE` and `XK_Serbian_DZE` were pure synonyms.
>     
>     (cherry picked from commit 6153c71cfb4698f1a416266564ecc748e4a25f2c)
> 
>  xkb/xkbUtils.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> commit 9e52a28be8aa763e1005f05affc7cef3c4219989
> Author: Olivier Fourdan <ofourdan@redhat.com>
> Date:   Wed Mar 22 11:31:03 2023 +0100
> 
>     test: Use either wayland-info or weston-info
>     
>     weston-info has been deprecated for quite some time, whereas wayland-info
>     may not be available yet.
>     
>     So we use either, depending on what's actually available.
>     
>     Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
>     Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
>     (cherry picked from commit fc625fe172d9f6a149a594b5214364bedf680239)
> 
>  test/scripts/xwayland-piglit.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> commit d2e27b0a8c05efe56a4179d053c0258f95d3772f
> Author: Joshua Ashton <joshua@froggi.es>
> Date:   Fri Mar 17 12:31:44 2023 +0000
> 
>     glamor: Don't glFlush/ctx switch unless any work has been performed
>     
>     `glamor_make_current` is always called before any calls to GL.
>     
>     Apply some dirty-tracking to whenever we call `glamor_make_current` so
>     that we can avoid a decent amount of redundant GL work on each
>     Dispatch cycle.
>     
>     Gamescope previously was waking up an empty Xwayland server with an
>     XQueryPointer and I noticed a significant amount of churn doing
>     redundant GL work.
>     
>     This has been addressed on the Gamescope side as well, but avoiding any
>     useless GL context switches and flushes when glamor is doing nothing
>     is still beneficial for CPU and power usage on portable devices.
>     
>     Signed-off-by: Joshua Ashton <joshua@froggi.es>
>     Reviewed-by: Emma Anholt <emma@anholt.net>
>     Acked-by: Olivier Fourdan <ofourdan@redhat.com
>     (cherry picked from commit 89163917e1976db4ae4863ad5337fa14bf348081)
> 
>  glamor/glamor.c       |  7 ++-----
>  glamor/glamor_priv.h  |  1 +
>  glamor/glamor_sync.c  |  3 +--
>  glamor/glamor_utils.h | 11 +++++++++++
>  4 files changed, 15 insertions(+), 7 deletions(-)
> 
> commit 667afc6f8db59b1da6af5afe74709978496eebf0
> Author: Adam Jackson <ajax@redhat.com>
> Date:   Thu Feb 2 12:26:27 2023 -0500
> 
>     present: Send a PresentConfigureNotify event for destroyed windows
>     
>     This enables fixing a deadlock case on the client side, where the client
>     ends up blocked waiting for a Present event that will never come because
>     the window was destroyed. The new PresentWindowDestroyed flag allows the
>     client to avoid blocking indefinitely.
>     
>     Signed-off-by: Adam Jackson <ajax@redhat.com>
>     See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/116
>     See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6685
>     Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
>     (cherry picked from commit 462b06033e66a32308d940eb5fc47f5e4c914dc0)
> 
>  present/present_event.c  |  5 +++--
>  present/present_priv.h   |  7 ++++++-
>  present/present_screen.c | 11 ++++++++++-
>  3 files changed, 19 insertions(+), 4 deletions(-)
> 
> commit f05528524613c1b2ea67fd45d45e84c319a5d6bd
> Author: Minh Phan <phanquangminh217@gmail.com>
> Date:   Sun Feb 5 14:38:32 2023 +0700
> 
>     xwayland/window: Do not double add window to damage list
>     
>     The window might be retained in the damage list after
>     `xwl_screen_post_damage` in certain conditions. This means we need to
>     check if the window is already in the list to avoid adding the same
>     window twice which will lead to list corruption resulting in server freeze
>     in `xwl_screen_post_damage`.
>     
>     Signed-off-by: Minh Phan <phanquangminh217@gmail.com>
>     (cherry picked from commit ba644a64a415962956de72936d21b6527ee8cd57)
> 
>  hw/xwayland/xwayland-window.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> commit 700ddafe0ccd1de1e95900f50aef3c20782369b0
> Author: Olivier Fourdan <ofourdan@redhat.com>
> Date:   Thu Feb 9 11:40:07 2023 +0100
> 
>     dix: Clear device sprite after free in AttachDevice()
>     
>     The code in AttachDevice() may free the dev->spriteInfo->sprite under
>     some circumstances and later call GetCurrentRootWindow() which uses
>     the same dev->spriteInfo->sprite.
>     
>     While it seems unlikely that this is actually an issue, considering the
>     cases where one or the other get called, it still makes the code look
>     suspicious.
>     
>     Make sure to clear set dev->spriteInfo->sprite to NULL  immediately
>     after it's freed to avoid any confusion, even if only to clarify the
>     code.
>     
>     Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
>     Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1436
>     (cherry picked from commit e196535abbf2ef4aa7c1eb0b4b9b67840032b88a)
> 
>  dix/devices.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> commit b2b3f67e09007f38af2066a076678da9e90449e8
> Author: Ivan A. Melnikov <iv@altlinux.org>
> Date:   Wed Dec 21 18:29:21 2022 +0400
> 
>     glamor: Don't initialize on softpipe
>     
>     There are systems where softpipe is the default renderer,
>     e.g. when llvmpipe is not is not available. Using glamor
>     on such systems is never a good idea.
>     
>     This mirrors what commit 0a9415cf793babed1f28c61f8047d51de04f1528
>     did for llvmpipe.
>     
>     Closes: #1417
>     
>     Signed-off-by: Ivan A. Melnikov <iv@altlinux.org>
>     (cherry picked from commit 711d491729d83b17114fd08d784bc0ddfd17ff6a)
> 
>  glamor/glamor_egl.c               | 5 +++++
>  hw/xwayland/xwayland-glamor-gbm.c | 4 ++++
>  2 files changed, 9 insertions(+)
> 
> commit e910626d37eb0030bf38d8595414e97e465e927a
> Author: Joshua Ashton <joshua@froggi.es>
> Date:   Thu Dec 29 08:05:19 2022 +0000
> 
>     xwayland: Don't expose XRandR emulated modes for leaseable displays
>     
>     Leasable displays do not have any actual associated Wayland output and
>     are not available to regular X11 clients and left entirely to the
>     application who requests the lease.
>     
>     As these are not actually managed by the Wayland compositor and left
>     entirely to the "lessee" application, the viewporter protocol required
>     for the XRandR emulation is not usable on such devices.
>     
>     We should therefore not advertise the XRandR emulated modes for those
>     leasable displays.
>     
>     This also solves a problem with implementations of glXGetMscRateOML()
>     which is used notably by Chromium/Electron. Applications using this
>     which will begin lagging/stuttering exponentially over
>     time, trying to look up a non-existent mode with 0x0 as returned by
>     XF86VidModeGetModeLine() with XRandR emulation for such devices.
>     
>     See-also: https://github.com/labwc/labwc/issues/553
>     Signed-off-by: Joshua Ashton <joshua@froggi.es>
>     (cherry picked from commit 0abb5770750e54566d3ce14a3be9dbf15bb578ba)
> 
>  hw/xwayland/xwayland-output.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> commit 6c2c2a2437d60c29ab2d2d7d8f7fa58a323880e9
> Author: Minh Phan <phanquangminh217@gmail.com>
> Date:   Tue Nov 29 19:37:22 2022 +0700
> 
>     xwayland/output: properly return the current emulated mode when queried
>     
>     This fixes an issue with GLFW-based games failing to set the resolution
>     when the user request to switch back to the native display mode.
>     
>     Signed-off-by: Minh Phan <phanquangminh217@gmail.com>
>     Acked-by: Olivier Fourdan <ofourdan@redhat.com>
>     (cherry picked from commit 511d1686a6ac3e3e0d66fb67b62620ba2a6575c8)
> 
>  hw/xwayland/xwayland-output.c | 16 ++++++++++++++++
>  hw/xwayland/xwayland-output.h |  1 +
>  2 files changed, 17 insertions(+)
> 
> commit 7d039914ff5baf1ebd5dca1ddcb8d3a74ba3587e
> Author: Minh Phan <phanquangminh217@gmail.com>
> Date:   Tue Nov 29 19:35:13 2022 +0700
> 
>     randr: introduce rrCrtcGetInfo DDX function
>     
>     This allows rrCrtcGetInfo to override the values in the XRRCrtcGetInfo
>     reply. One use case is to allow Xwayland to return the current emulated
>     mode for the specific client instead of the global mode.
>     
>     Signed-off-by: Minh Phan <phanquangminh217@gmail.com>
>     Acked-by: Olivier Fourdan <ofourdan@redhat.com>
>     (cherry picked from commit 5145742fb6e3d108b05db1521b51112e0dbfb95a)
> 
>  randr/randrstr.h | 8 ++++++++
>  randr/rrcrtc.c   | 3 +++
>  2 files changed, 11 insertions(+)
> 
> commit cedf933c7cbbc0285e7f9ddb17706b9a8d84f6aa
> Author: Doğukan Korkmaztürk <dkorkmazturk@nvidia.com>
> Date:   Tue Nov 22 13:43:16 2022 -0500
> 
>     GLX: Free the tag of the old context later
>     
>     In CommonMakeCurrent() function, the tag of the old context is freed
>     before the new context is made current. This is problematic because if
>     the CommonMakeNewCurrent() function fails, the tag of the old context
>     ends up being removed, even though it is still active. This causes
>     subsequent glXMakeCurrent() or glXMakeContextCurrent() requests to
>     generate a GLXBadContextTag error.
>     
>     This change moves the function call that frees the old tag to a location
>     where the result of CommonMakeNewCurrent() call is known and it is safe
>     to free it.
>     
>     Signed-off-by: Doğukan Korkmaztürk <dkorkmazturk@nvidia.com>
>     (cherry picked from commit 4781f2a5a8c2c2b000374e2d87982a6701d5a6b3)
> 
>  glx/vndcmds.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> commit e982ca4420a6003c97cb076ee40172e904ce290a
> Author: Doğukan Korkmaztürk <dkorkmazturk@nvidia.com>
> Date:   Tue Nov 8 10:05:59 2022 -0500
> 
>     xwayland/glx: Mirror all EGLConfigs
>     
>     Updated the for-loop that iterates over the received EGLConfigs to
>     include the very first EGLConfig with index 0.
>     
>     Signed-off-by: Doğukan Korkmaztürk <dkorkmazturk@nvidia.com>
>     Fixes: 8469241592 - xwayland: Add EGL-backed GLX provider
>     (cherry picked from commit 3852b0d10a061348ea8214fbcbef3c5c08cac0b6)
> 
>  hw/xwayland/xwayland-glx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> commit 4303ddfbf98023f33c1067007543df345c68b459
> Author: Corentin Noël <corentin.noel@collabora.com>
> Date:   Mon Aug 1 16:03:38 2022 +0200
> 
>     glamor: Only check for llvmpipe renderer
>     
>     The virgl driver exposes the name of the host renderer which might be llvmpipe.
>     In this case we still need glamor to be initialized.
>     
>     Only check if the renderer starts with llvmpipe (which is what llvmpipe exposes).
>     
>     Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
>     Reviewed-by: Adam Jackson <ajax@redhat.com>
>     (cherry picked from commit fdebbc60d89cdc1b3353424b6568b25a61dcf372)
> 
>  glamor/glamor_egl.c               | 2 +-
>  hw/xwayland/xwayland-glamor-gbm.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> commit bc288f59a4d6bf5e713f1473e42d9cdb20d879bf
> Author: Lucas Stach <l.stach@pengutronix.de>
> Date:   Sun Jul 10 17:51:14 2022 +0200
> 
>     xwayland: properly get FDs from multiplanar GBM BOs
>     
>     Multiplanar GBM buffers can point to different objects from each plane.
>     Use the _for_plane API when possible to retrieve the correct prime FD
>     for each plane.
>     
>     Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
>     Reviewed-by: Simon Ser <contact@emersion.fr>
>     Tested-by: Guido Günther <agx@sigxcpu.org>
>     (cherry picked from commit 7d5ad2d372cc88648f6744c318a4bee18443689d)
> 
>  hw/xwayland/xwayland-glamor-gbm.c | 66 +++++++++++++++++++++++++++++++++------
>  1 file changed, 57 insertions(+), 9 deletions(-)
> 
> commit 57db30e637192df0600999cd40ec14edbeb1c68a
> Author: Lucas Stach <l.stach@pengutronix.de>
> Date:   Thu Jul 28 22:44:59 2022 +0200
> 
>     xwayland: handle fd export failure in glamor_egl_fds_from_pixmap
>     
>     Check the fd for validity before giving a success return code.
>     
>     Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
>     Reviewed-by: Simon Ser <contact@emersion.fr>
>     Tested-by: Guido Günther <agx@sigxcpu.org>
>     (cherry picked from commit 951502e49797ab4c5db047e9df32c93d050d64af)
> 
>  hw/xwayland/xwayland-glamor-gbm.c | 7 +++++++
>  1 file changed, 7 insertions(+)


unblock xwayland/2:22.1.9-1
diff -Nru xwayland-22.1.8/composite/compwindow.c xwayland-22.1.9/composite/compwindow.c
--- xwayland-22.1.8/composite/compwindow.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/composite/compwindow.c	2023-03-29 14:22:52.000000000 +0200
@@ -620,6 +620,11 @@
     ret = (*pScreen->DestroyWindow) (pWin);
     cs->DestroyWindow = pScreen->DestroyWindow;
     pScreen->DestroyWindow = compDestroyWindow;
+
+    /* Did we just destroy the overlay window? */
+    if (pWin == cs->pOverlayWin)
+        cs->pOverlayWin = NULL;
+
 /*    compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
     return ret;
 }
diff -Nru xwayland-22.1.8/debian/changelog xwayland-22.1.9/debian/changelog
--- xwayland-22.1.8/debian/changelog	2023-02-07 14:14:38.000000000 +0100
+++ xwayland-22.1.9/debian/changelog	2023-03-29 15:23:04.000000000 +0200
@@ -1,3 +1,10 @@
+xwayland (2:22.1.9-1) unstable; urgency=high
+
+  * New upstream bugfix release
+    - composite: Fix use-after-free of the COW (CVE-2023-1393)
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 29 Mar 2023 15:23:04 +0200
+
 xwayland (2:22.1.8-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru xwayland-22.1.8/dix/devices.c xwayland-22.1.9/dix/devices.c
--- xwayland-22.1.8/dix/devices.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/dix/devices.c	2023-03-29 14:22:52.000000000 +0200
@@ -2627,6 +2627,7 @@
         screen = miPointerGetScreen(dev);
         screen->DeviceCursorCleanup(dev, screen);
         free(dev->spriteInfo->sprite);
+        dev->spriteInfo->sprite = NULL;
     }
 
     dev->master = master;
diff -Nru xwayland-22.1.8/glamor/glamor.c xwayland-22.1.9/glamor/glamor.c
--- xwayland-22.1.8/glamor/glamor.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/glamor/glamor.c	2023-03-29 14:22:52.000000000 +0200
@@ -271,9 +271,7 @@
 glamor_block_handler(ScreenPtr screen)
 {
     glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
-
-    glamor_make_current(glamor_priv);
-    glFlush();
+    glamor_flush(glamor_priv);
 }
 
 static void
@@ -281,8 +279,7 @@
 {
     glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
 
-    glamor_make_current(glamor_priv);
-    glFlush();
+    glamor_flush(glamor_priv);
 
     screen->BlockHandler = glamor_priv->saved_procs.block_handler;
     screen->BlockHandler(screen, timeout);
diff -Nru xwayland-22.1.8/glamor/glamor_egl.c xwayland-22.1.9/glamor/glamor_egl.c
--- xwayland-22.1.8/glamor/glamor_egl.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/glamor/glamor_egl.c	2023-03-29 14:22:52.000000000 +0200
@@ -1053,7 +1053,12 @@
                    "glGetString() returned NULL, your GL is broken\n");
         goto error;
     }
-    if (strstr((const char *)renderer, "llvmpipe")) {
+    if (strstr((const char *)renderer, "softpipe")) {
+        xf86DrvMsg(scrn->scrnIndex, X_INFO,
+                   "Refusing to try glamor on softpipe\n");
+        goto error;
+    }
+    if (!strncmp("llvmpipe", (const char *)renderer, strlen("llvmpipe"))) {
         if (scrn->confScreen->num_gpu_devices)
             xf86DrvMsg(scrn->scrnIndex, X_INFO,
                        "Allowing glamor on llvmpipe for PRIME\n");
diff -Nru xwayland-22.1.8/glamor/glamor_priv.h xwayland-22.1.9/glamor/glamor_priv.h
--- xwayland-22.1.8/glamor/glamor_priv.h	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/glamor/glamor_priv.h	2023-03-29 14:22:52.000000000 +0200
@@ -313,6 +313,7 @@
     Bool suppress_gl_out_of_memory_logging;
     Bool logged_any_fbo_allocation_failure;
     Bool logged_any_pbo_allocation_failure;
+    Bool dirty;
 
     /* xv */
     glamor_program xv_prog;
diff -Nru xwayland-22.1.8/glamor/glamor_sync.c xwayland-22.1.9/glamor/glamor_sync.c
--- xwayland-22.1.8/glamor/glamor_sync.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/glamor/glamor_sync.c	2023-03-29 14:22:52.000000000 +0200
@@ -52,8 +52,7 @@
 	struct glamor_sync_fence *glamor_fence = glamor_get_sync_fence(fence);
 
 	/* Flush pending rendering operations */
-        glamor_make_current(glamor);
-        glFlush();
+	glamor_flush(glamor);
 
 	fence->funcs.SetTriggered = glamor_fence->set_triggered;
 	fence->funcs.SetTriggered(fence);
diff -Nru xwayland-22.1.8/glamor/glamor_utils.h xwayland-22.1.9/glamor/glamor_utils.h
--- xwayland-22.1.8/glamor/glamor_utils.h	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/glamor/glamor_utils.h	2023-03-29 14:22:52.000000000 +0200
@@ -672,6 +672,17 @@
         lastGLContext = glamor_priv->ctx.ctx;
         glamor_priv->ctx.make_current(&glamor_priv->ctx);
     }
+    glamor_priv->dirty = TRUE;
+}
+
+static inline void
+glamor_flush(glamor_screen_private *glamor_priv)
+{
+    if (glamor_priv->dirty) {
+        glamor_make_current(glamor_priv);
+        glFlush();
+        glamor_priv->dirty = FALSE;
+    }
 }
 
 static inline BoxRec
diff -Nru xwayland-22.1.8/glx/vndcmds.c xwayland-22.1.9/glx/vndcmds.c
--- xwayland-22.1.8/glx/vndcmds.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/glx/vndcmds.c	2023-03-29 14:22:52.000000000 +0200
@@ -165,9 +165,6 @@
             tagInfo->tag, // No old context tag,
             None, None, None, 0);
 
-    if (ret == Success) {
-        GlxFreeContextTag(tagInfo);
-    }
     return ret;
 }
 
@@ -259,7 +256,6 @@
             if (ret != Success) {
                 return ret;
             }
-            oldTag = NULL;
         }
 
         if (newVendor != NULL) {
@@ -270,6 +266,9 @@
         } else {
             reply.contextTag = 0;
         }
+
+        GlxFreeContextTag(oldTag);
+        oldTag = NULL;
     }
 
     reply.contextTag = GlxCheckSwap(client, reply.contextTag);
diff -Nru xwayland-22.1.8/hw/xwayland/xwayland-glamor-gbm.c xwayland-22.1.9/hw/xwayland/xwayland-glamor-gbm.c
--- xwayland-22.1.8/hw/xwayland/xwayland-glamor-gbm.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/hw/xwayland/xwayland-glamor-gbm.c	2023-03-29 14:22:52.000000000 +0200
@@ -354,12 +354,15 @@
     unsigned short width = pixmap->drawable.width;
     unsigned short height = pixmap->drawable.height;
     uint32_t format;
-    int prime_fd;
     int num_planes;
+    int prime_fds[4];
     uint32_t strides[4];
     uint32_t offsets[4];
     uint64_t modifier;
     int i;
+#ifndef GBM_BO_FD_FOR_PLANE
+    int32_t first_handle;
+#endif
 
     if (xwl_pixmap == NULL)
        return NULL;
@@ -374,20 +377,43 @@
 
     format = wl_drm_format_for_depth(pixmap->drawable.depth);
 
-    prime_fd = gbm_bo_get_fd(xwl_pixmap->bo);
-    if (prime_fd == -1)
-        return NULL;
-
 #ifdef GBM_BO_WITH_MODIFIERS
     num_planes = gbm_bo_get_plane_count(xwl_pixmap->bo);
     modifier = gbm_bo_get_modifier(xwl_pixmap->bo);
     for (i = 0; i < num_planes; i++) {
+#ifdef GBM_BO_FD_FOR_PLANE
+        prime_fds[i] = gbm_bo_get_fd_for_plane(xwl_pixmap->bo, i);
+#else
+        union gbm_bo_handle plane_handle;
+
+        plane_handle = gbm_bo_get_handle_for_plane(xwl_pixmap->bo, i);
+        if (i == 0)
+            first_handle = plane_handle.s32;
+
+        /* If all planes point to the same object as the first plane, i.e. they
+         * all have the same handle, we can fall back to the non-planar
+         * gbm_bo_get_fd without losing information. If they point to different
+         * objects we are out of luck and need to give up.
+         */
+        if (first_handle == plane_handle.s32)
+            prime_fds[i] = gbm_bo_get_fd(xwl_pixmap->bo);
+        else
+            prime_fds[i] = -1;
+#endif
+        if (prime_fds[i] == -1) {
+            while (--i >= 0)
+                close(prime_fds[i]);
+            return NULL;
+        }
         strides[i] = gbm_bo_get_stride_for_plane(xwl_pixmap->bo, i);
         offsets[i] = gbm_bo_get_offset(xwl_pixmap->bo, i);
     }
 #else
     num_planes = 1;
     modifier = DRM_FORMAT_MOD_INVALID;
+    prime_fds[0] = gbm_bo_get_fd(xwl_pixmap->bo);
+    if (prime_fds[0] == -1)
+        return NULL;
     strides[0] = gbm_bo_get_stride(xwl_pixmap->bo);
     offsets[0] = 0;
 #endif
@@ -398,7 +424,7 @@
 
         params = zwp_linux_dmabuf_v1_create_params(xwl_screen->dmabuf);
         for (i = 0; i < num_planes; i++) {
-            zwp_linux_buffer_params_v1_add(params, prime_fd, i,
+            zwp_linux_buffer_params_v1_add(params, prime_fds[i], i,
                                            offsets[i], strides[i],
                                            modifier >> 32, modifier & 0xffffffff);
         }
@@ -409,14 +435,15 @@
         zwp_linux_buffer_params_v1_destroy(params);
     } else if (num_planes == 1) {
         xwl_pixmap->buffer =
-            wl_drm_create_prime_buffer(xwl_gbm->drm, prime_fd, width, height,
+            wl_drm_create_prime_buffer(xwl_gbm->drm, prime_fds[0], width, height,
                                        format,
                                        0, gbm_bo_get_stride(xwl_pixmap->bo),
                                        0, 0,
                                        0, 0);
     }
 
-    close(prime_fd);
+    for (i = 0; i < num_planes; i++)
+        close(prime_fds[i]);
 
     /* Add our listener now */
     wl_buffer_add_listener(xwl_pixmap->buffer,
@@ -610,6 +637,9 @@
 {
     struct xwl_pixmap *xwl_pixmap;
 #ifdef GBM_BO_WITH_MODIFIERS
+#ifndef GBM_BO_FD_FOR_PLANE
+    int32_t first_handle;
+#endif
     uint32_t num_fds;
     int i;
 #endif
@@ -627,7 +657,30 @@
     *modifier = gbm_bo_get_modifier(xwl_pixmap->bo);
 
     for (i = 0; i < num_fds; i++) {
-        fds[i] = gbm_bo_get_fd(xwl_pixmap->bo);
+#ifdef GBM_BO_FD_FOR_PLANE
+        fds[i] = gbm_bo_get_fd_for_plane(xwl_pixmap->bo, i);
+#else
+        union gbm_bo_handle plane_handle;
+
+        plane_handle = gbm_bo_get_handle_for_plane(xwl_pixmap->bo, i);
+        if (i == 0)
+            first_handle = plane_handle.s32;
+
+        /* If all planes point to the same object as the first plane, i.e. they
+         * all have the same handle, we can fall back to the non-planar
+         * gbm_bo_get_fd without losing information. If they point to different
+         * objects we are out of luck and need to give up.
+         */
+        if (first_handle == plane_handle.s32)
+            fds[i] = gbm_bo_get_fd(xwl_pixmap->bo);
+        else
+            fds[i] = -1;
+#endif
+        if (fds[i] == -1) {
+            while (--i >= 0)
+                close(fds[i]);
+            return 0;
+        }
         strides[i] = gbm_bo_get_stride_for_plane(xwl_pixmap->bo, i);
         offsets[i] = gbm_bo_get_offset(xwl_pixmap->bo, i);
     }
@@ -636,6 +689,8 @@
 #else
     *modifier = DRM_FORMAT_MOD_INVALID;
     fds[0] = gbm_bo_get_fd(xwl_pixmap->bo);
+    if (fds[0] == -1)
+        return 0;
     strides[0] = gbm_bo_get_stride(xwl_pixmap->bo);
     offsets[0] = 0;
     return 1;
@@ -975,7 +1030,11 @@
         ErrorF("glGetString() returned NULL, your GL is broken\n");
         goto error;
     }
-    if (strstr((const char *)renderer, "llvmpipe")) {
+    if (strstr((const char *)renderer, "softpipe")) {
+        ErrorF("Refusing to try glamor on softpipe\n");
+        goto error;
+    }
+    if (!strncmp("llvmpipe", (const char *)renderer, strlen("llvmpipe"))) {
         ErrorF("Refusing to try glamor on llvmpipe\n");
         goto error;
     }
diff -Nru xwayland-22.1.8/hw/xwayland/xwayland-glx.c xwayland-22.1.9/hw/xwayland/xwayland-glx.c
--- xwayland-22.1.8/hw/xwayland/xwayland-glx.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/hw/xwayland/xwayland-glx.c	2023-03-29 14:22:52.000000000 +0200
@@ -339,7 +339,7 @@
     /* We walk the EGL configs backwards to make building the
      * ->next chain easier.
      */
-    for (i = nconfigs - 1; i > 0; i--)
+    for (i = nconfigs - 1; i >= 0; i--)
         for (j = 0; j < 3; j++) /* direct_color */
             for (k = 0; k < 2; k++) /* double_buffer */ {
                 if (can_srgb)
diff -Nru xwayland-22.1.8/hw/xwayland/xwayland-output.c xwayland-22.1.9/hw/xwayland/xwayland-output.c
--- xwayland-22.1.8/hw/xwayland/xwayland-output.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/hw/xwayland/xwayland-output.c	2023-03-29 14:22:52.000000000 +0200
@@ -223,6 +223,10 @@
     if (!xwl_output)
         return NULL;
 
+    /* We don't do XRandr emulation when a fake lease display */
+    if (!xwl_output->output)
+        return NULL;
+
     for (i = 0; i < XWL_CLIENT_MAX_EMULATED_MODES; i++) {
         if (xwl_client->emulated_modes[i].server_output_id ==
             xwl_output->server_output_id)
@@ -266,6 +270,7 @@
     emulated_mode->server_output_id = xwl_output->server_output_id;
     emulated_mode->width  = mode->mode.width;
     emulated_mode->height = mode->mode.height;
+    emulated_mode->id = mode->mode.id;
     emulated_mode->from_vidmode = from_vidmode;
 }
 
@@ -902,6 +907,20 @@
     return TRUE;
 }
 
+static void
+xwl_randr_crtc_get(ScreenPtr pScreen,
+                   RRCrtcPtr crtc,
+                   xRRGetCrtcInfoReply *rep)
+{
+    struct xwl_output *xwl_output = crtc->devPrivate;
+
+    struct xwl_emulated_mode *mode = xwl_output_get_emulated_mode_for_client(
+        xwl_output, GetCurrentClient());
+
+    if (mode)
+        rep->mode = mode->id;
+}
+
 static Bool
 xwl_randr_crtc_set_gamma(ScreenPtr pScreen, RRCrtcPtr crtc)
 {
@@ -962,6 +981,7 @@
 #if RANDR_12_INTERFACE
     rp->rrScreenSetSize = xwl_randr_screen_set_size;
     rp->rrCrtcSet = xwl_randr_crtc_set;
+    rp->rrCrtcGet = xwl_randr_crtc_get;
     rp->rrCrtcSetGamma = xwl_randr_crtc_set_gamma;
     rp->rrCrtcGetGamma = xwl_randr_crtc_get_gamma;
     rp->rrOutputSetProperty = xwl_randr_output_set_property;
diff -Nru xwayland-22.1.8/hw/xwayland/xwayland-output.h xwayland-22.1.9/hw/xwayland/xwayland-output.h
--- xwayland-22.1.8/hw/xwayland/xwayland-output.h	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/hw/xwayland/xwayland-output.h	2023-03-29 14:22:52.000000000 +0200
@@ -69,6 +69,7 @@
     uint32_t server_output_id;
     int32_t width;
     int32_t height;
+    RRMode id;
     Bool from_vidmode;
 };
 
diff -Nru xwayland-22.1.8/hw/xwayland/xwayland-window.c xwayland-22.1.9/hw/xwayland/xwayland-window.c
--- xwayland-22.1.8/hw/xwayland/xwayland-window.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/hw/xwayland/xwayland-window.c	2023-03-29 14:22:52.000000000 +0200
@@ -175,7 +175,8 @@
     }
 #endif
 
-    xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list);
+    if (xorg_list_is_empty(&xwl_window->link_damage))
+        xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list);
 }
 
 static void
diff -Nru xwayland-22.1.8/meson.build xwayland-22.1.9/meson.build
--- xwayland-22.1.8/meson.build	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/meson.build	2023-03-29 14:22:52.000000000 +0200
@@ -3,10 +3,10 @@
             'buildtype=debugoptimized',
             'c_std=gnu99',
         ],
-        version: '22.1.8',
+        version: '22.1.9',
         meson_version: '>= 0.47.0',
 )
-release_date = '2023-02-07'
+release_date = '2023-03-29'
 
 add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc'])
 cc = meson.get_compiler('c')
diff -Nru xwayland-22.1.8/present/present_event.c xwayland-22.1.9/present/present_event.c
--- xwayland-22.1.8/present/present_event.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/present/present_event.c	2023-03-29 14:22:52.000000000 +0200
@@ -102,7 +102,8 @@
 }
 
 void
-present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling)
+present_send_config_notify(WindowPtr window, int x, int y, int w, int h,
+                           int bw, WindowPtr sibling, CARD32 flags)
 {
     present_window_priv_ptr window_priv = present_window_priv(window);
 
@@ -122,7 +123,7 @@
             .off_y = 0,
             .pixmap_width = w,
             .pixmap_height = h,
-            .pixmap_flags = 0
+            .pixmap_flags = flags
         };
         present_event_ptr event;
 
diff -Nru xwayland-22.1.8/present/present_priv.h xwayland-22.1.9/present/present_priv.h
--- xwayland-22.1.8/present/present_priv.h	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/present/present_priv.h	2023-03-29 14:22:52.000000000 +0200
@@ -43,6 +43,11 @@
 #define DebugPresent(x)
 #endif
 
+/* XXX this belongs in presentproto */
+#ifndef PresentWindowDestroyed
+#define PresentWindowDestroyed (1 << 0)
+#endif
+
 extern int present_request;
 
 extern DevPrivateKeyRec present_screen_private_key;
@@ -307,7 +312,7 @@
 present_free_events(WindowPtr window);
 
 void
-present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling);
+present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling, CARD32 flags);
 
 void
 present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 serial, uint64_t ust, uint64_t msc);
diff -Nru xwayland-22.1.8/present/present_screen.c xwayland-22.1.9/present/present_screen.c
--- xwayland-22.1.8/present/present_screen.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/present/present_screen.c	2023-03-29 14:22:52.000000000 +0200
@@ -93,6 +93,15 @@
     present_screen_priv_ptr screen_priv = present_screen_priv(screen);
     present_window_priv_ptr window_priv = present_window_priv(window);
 
+    present_send_config_notify(window,
+                               window->drawable.x,
+                               window->drawable.y,
+                               window->drawable.width,
+                               window->drawable.height,
+                               window->borderWidth,
+                               window->nextSib,
+                               PresentWindowDestroyed);
+
     if (window_priv) {
         present_clear_window_notifies(window);
         present_free_events(window);
@@ -123,7 +132,7 @@
     ScreenPtr screen = window->drawable.pScreen;
     present_screen_priv_ptr screen_priv = present_screen_priv(screen);
 
-    present_send_config_notify(window, x, y, w, h, bw, sibling);
+    present_send_config_notify(window, x, y, w, h, bw, sibling, 0);
 
     unwrap(screen_priv, screen, ConfigNotify);
     if (screen->ConfigNotify)
diff -Nru xwayland-22.1.8/randr/randrstr.h xwayland-22.1.9/randr/randrstr.h
--- xwayland-22.1.8/randr/randrstr.h	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/randr/randrstr.h	2023-03-29 14:22:52.000000000 +0200
@@ -218,6 +218,10 @@
                                   Rotation rotation,
                                   int numOutputs, RROutputPtr * outputs);
 
+typedef void (*RRCrtcGetProcPtr) (ScreenPtr pScreen,
+                                  RRCrtcPtr crtc,
+                                  xRRGetCrtcInfoReply *rep);
+
 typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
 
 typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
@@ -420,6 +424,10 @@
 
     RRRequestLeaseProcPtr rrRequestLease;
     RRGetLeaseProcPtr rrGetLease;
+
+#if RANDR_12_INTERFACE
+    RRCrtcGetProcPtr rrCrtcGet;
+#endif
 } rrScrPrivRec, *rrScrPrivPtr;
 
 extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
diff -Nru xwayland-22.1.8/randr/rrcrtc.c xwayland-22.1.9/randr/rrcrtc.c
--- xwayland-22.1.8/randr/rrcrtc.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/randr/rrcrtc.c	2023-03-29 14:22:52.000000000 +0200
@@ -1269,6 +1269,9 @@
         }
     }
 
+    if (pScrPriv->rrCrtcGet)
+        pScrPriv->rrCrtcGet(pScreen, crtc, &rep);
+
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
diff -Nru xwayland-22.1.8/test/scripts/xwayland-piglit.sh xwayland-22.1.9/test/scripts/xwayland-piglit.sh
--- xwayland-22.1.8/test/scripts/xwayland-piglit.sh	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/test/scripts/xwayland-piglit.sh	2023-03-29 14:22:52.000000000 +0200
@@ -17,8 +17,13 @@
 WESTON_PID=$!
 export WAYLAND_DISPLAY=wayland-$$
 
+# We can use either wayland-info or weston-info (deprecated), depending
+# on what's actually available.
+WAYLAND_INFO=wayland-info
+command -V $WAYLAND_INFO >/dev/null 2>&1 || WAYLAND_INFO=weston-info
+
 # Wait for weston to initialize before starting Xwayland
-timeout --preserve-status 60s bash -c 'while ! weston-info &>/dev/null; do sleep 1; done'
+timeout --preserve-status 60s bash -c "while ! $WAYLAND_INFO &>/dev/null; do sleep 1; done"
 
 # Start an Xwayland server
 export PIGLIT_RESULTS_DIR=$XSERVER_BUILDDIR/test/piglit-results/xwayland
diff -Nru xwayland-22.1.8/xkb/xkbUtils.c xwayland-22.1.9/xkb/xkbUtils.c
--- xwayland-22.1.8/xkb/xkbUtils.c	2023-02-07 08:30:43.000000000 +0100
+++ xwayland-22.1.9/xkb/xkbUtils.c	2023-03-29 14:22:52.000000000 +0200
@@ -902,9 +902,9 @@
         break;
     case 6:                    /* Cyrillic */
         /* Assume the KeySym is a legal value (ignore discontinuities) */
-        if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE)
+        if (sym >= XK_Serbian_DJE && sym <= XK_Cyrillic_DZHE)
             *lower -= (XK_Serbian_DJE - XK_Serbian_dje);
-        else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze)
+        else if (sym >= XK_Serbian_dje && sym <= XK_Cyrillic_dzhe)
             *upper += (XK_Serbian_DJE - XK_Serbian_dje);
         else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN)
             *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu);

--- End Message ---
--- Begin Message ---
Unblocked.

--- End Message ---

Reply to: