xserver: Branch 'master' - 2 commits

Adam Jackson ajax at kemper.freedesktop.org
Thu Jan 25 15:43:12 UTC 2018


 hw/xwayland/xwayland.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit fc8b7d05e74a6351df56ad8b17216aeb0dcc016b
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Thu Jan 25 13:43:09 2018 +0100

    xwayland: place a manual redirect on windows
    
    Place a manual redirect on windows on xwl_realize_window() and remove
    it on xwl_unrealize_window() to avoid the X11 window manager removing
    its redirect before Xwayland has unrealized the window (e.g. if the X11
    window manager has terminated unexpectedly)
    
    Suggested by Daniel Stone <daniel at fooishbar.org>
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 88d31f80b..19aa14a47 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -32,6 +32,7 @@
 #include <micmap.h>
 #include <misyncshm.h>
 #include <compositeext.h>
+#include <compint.h>
 #include <glx_extinit.h>
 #include <os.h>
 #include <xserver_poll.h>
@@ -528,6 +529,8 @@ xwl_realize_window(WindowPtr window)
         goto err_surf;
     }
 
+    compRedirectWindow(serverClient, window, CompositeRedirectManual);
+
     DamageRegister(&window->drawable, xwl_window->damage);
     DamageSetReportAfterOp(xwl_window->damage, TRUE);
 
@@ -575,6 +578,8 @@ xwl_unrealize_window(WindowPtr window)
         xwl_seat_clear_touch(xwl_seat, window);
     }
 
+    compUnredirectWindow(serverClient, window, CompositeRedirectManual);
+
     screen->UnrealizeWindow = xwl_screen->UnrealizeWindow;
     ret = (*screen->UnrealizeWindow) (window);
     xwl_screen->UnrealizeWindow = screen->UnrealizeWindow;
commit 3362422e8413dd9f231cfac50ce0a0862525b1bf
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Wed Jan 24 17:45:37 2018 +0100

    xwayland: remove dirty window unconditionally on unrealize
    
    This is a rare occurrence of a crash in Xwayland for which I don't have
    the reproducing steps, just a core file.
    
    The backtrace looks as follow:
    
      #0  raise () from /usr/lib64/libc.so.6
      #1  abort () from /usr/lib64/libc.so.6
      #2  OsAbort () at utils.c:1361
      #3  AbortServer () at log.c:877
      #4  FatalError () at log.c:1015
      #5  OsSigHandler () at osinit.c:154
      #6  <signal handler called>
      #7  xwl_glamor_pixmap_get_wl_buffer () at xwayland-glamor.c:162
      #8  xwl_screen_post_damage () at xwayland.c:514
      #9  block_handler () at xwayland.c:665
      #10 BlockHandler () at dixutils.c:388
      #11 WaitForSomething () at WaitFor.c:219
      #12 Dispatch () at dispatch.c:422
      #13 dix_main () at main.c:287
    
    The crash is caused by dereferencing “xwl_pixmap->buffer” in
    xwl_glamor_pixmap_get_wl_buffer() because “xwl_pixmap” is NULL.
    
    Reason for this is because the corresponding pixmap is from the root
    window and xwayland is rootless by default.
    
    This can happen if the window was mapped, redirected, damaged and
    unredirected immediately, before the damage is processed by Xwayland.
    
    Make sure to remove the dirty window from the damage list on unrealize
    to prevent this from happening.
    
    Credit goes to Adam Jackson <ajax at nwnk.net> and Daniel Stone
    <daniel at fooishbar.org> for finding the root cause the issue.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Daniel Stone <daniels at collabora.com>

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index ab7cee545..88d31f80b 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -587,8 +587,7 @@ xwl_unrealize_window(WindowPtr window)
     }
 
     wl_surface_destroy(xwl_window->surface);
-    if (RegionNotEmpty(DamageRegion(xwl_window->damage)))
-        xorg_list_del(&xwl_window->link_damage);
+    xorg_list_del(&xwl_window->link_damage);
     DamageUnregister(xwl_window->damage);
     DamageDestroy(xwl_window->damage);
     if (xwl_window->frame_callback)


More information about the xorg-commit mailing list