xserver: Branch 'master' - 3 commits

Adam Jackson ajax at kemper.freedesktop.org
Wed Nov 30 17:35:00 UTC 2016


 configure.ac                 |    5 +----
 glamor/glamor.c              |   11 ++++++++---
 hw/xwayland/xwayland-input.c |   17 +++++++++++++----
 3 files changed, 22 insertions(+), 11 deletions(-)

New commits:
commit e1d30075c923f96a375895d74ea12a3c92a640c6
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Nov 22 10:51:24 2016 -0500

    configure: Enable glamor when building just Xwayland
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Acked-by: Daniel Stone <daniels at collabora.com>
    Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
    Tested-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/configure.ac b/configure.ac
index 6fd853b..93c81a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2138,10 +2138,7 @@ AM_CONDITIONAL([XORG_DRIVER_MODESETTING], [test "x$XORG_DRIVER_MODESETTING" = xy
 
 dnl glamor
 if test "x$GLAMOR" = xauto; then
-	if test "x$XORG" = xyes; then
-		GLAMOR=yes
-	fi
-	if test "x$XEPHYR" = xyes; then
+	if echo "$XORG" "$XEPHYR" "$XWAYLAND" | grep -q yes ; then
 		GLAMOR=yes
 	fi
 fi
commit 59ad0e6a416d8e23f9d962af67a16ee28ec7867b
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Wed Nov 30 09:42:43 2016 +0100

    xwayland: Fix use after free of cursors
    
    Sometimes, Xwayland will try to use a cursor that has just been freed,
    leading to a crash when trying to access that cursor data either in
    miPointerUpdateSprite() or AnimCurTimerNotify().
    
    CheckMotion() updates the pointer's cursor based on which xwindow
    XYToWindow() returns, and Xwayland implements its own xwl_xy_to_window()
    to fake a crossing to the root window when the pointer has left the
    Wayland surface but is still within the xwindow.
    
    But after an xwindow is unrealized, the last xwindow used to match the
    xwindows is cleared so two consecutive calls to xwl_xy_to_window() may
    not return the same xwindow.
    
    To avoid this issue, update the last_xwindow based on enter and leave
    notifications instead of xwl_xy_to_window(), and check if the xwindow
    found by the regular miXYToWindow() is a child of the known last
    xwindow, so that multiple consecutive calls to xwl_xy_to_window()
    return the same xwindow, being either the one found by miXYToWindow()
    or the root window.
    
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1385258
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Tested-by: Vít Ondruch <vondruch at redhat.com>
    Tested-by: Satish Balay <balay at fastmail.fm>
    Reviewed-by: Jonas Ådahl <jadahl at gmail.com>

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 3bc7110..580df09 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -312,6 +312,9 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
     dx = xwl_seat->focus_window->window->drawable.x;
     dy = xwl_seat->focus_window->window->drawable.y;
 
+    /* We just entered a new xwindow, forget about the old last xwindow */
+    xwl_seat->last_xwindow = NullWindow;
+
     master = GetMaster(dev, POINTER_OR_FLOAT);
     (*pScreen->SetCursorPosition) (dev, pScreen, dx + sx, dy + sy, TRUE);
 
@@ -360,8 +363,14 @@ pointer_handle_leave(void *data, struct wl_pointer *pointer,
 
     xwl_seat->xwl_screen->serial = serial;
 
-    xwl_seat->focus_window = NULL;
-    CheckMotion(NULL, GetMaster(dev, POINTER_OR_FLOAT));
+    /* The pointer has left a known xwindow, save it for a possible match
+     * in sprite_check_lost_focus()
+     */
+    if (xwl_seat->focus_window) {
+        xwl_seat->last_xwindow = xwl_seat->focus_window->window;
+        xwl_seat->focus_window = NULL;
+        CheckMotion(NULL, GetMaster(dev, POINTER_OR_FLOAT));
+    }
 }
 
 static void
@@ -1252,10 +1261,10 @@ sprite_check_lost_focus(SpritePtr sprite, WindowPtr window)
      */
     if (master->lastSlave == xwl_seat->pointer &&
         xwl_seat->focus_window == NULL &&
-        xwl_seat->last_xwindow == window)
+        xwl_seat->last_xwindow != NullWindow &&
+        IsParent(xwl_seat->last_xwindow, window))
         return TRUE;
 
-    xwl_seat->last_xwindow = window;
     return FALSE;
 }
 
commit f43207c1c4a8487600cf3ea116c10437417c861b
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Thu Nov 3 09:59:30 2016 +0100

    glamor: restore vfunc handlers on init failure
    
    In glamor_init(), if the minimum requirements are not met, glamor may
    fail after setting up its own CloseScreen() and DestroyPixmap()
    routines, leading to a crash when either of the two routines is called
    if glamor failed to complete its initialization, e.g:
    
      (EE) Backtrace:
      (EE) 0:  Xwayland (OsSigHandler+0x29)
      (EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0)
      (EE) 2: Xwayland (glamor_sync_close+0x2a)
      (EE) 3: Xwayland (glamor_close_screen+0x52)
      (EE) 4: Xwayland (CursorCloseScreen+0x88)
      (EE) 5: Xwayland (AnimCurCloseScreen+0xa4)
      (EE) 6: Xwayland (present_close_screen+0x42)
      (EE) 7: Xwayland (dix_main+0x4f9)
      (EE) 8: /lib64/libc.so.6 (__libc_start_main+0xf1)
      (EE) 9:  Xwayland (_start+0x2a)
    
    Restore the previous CloseScreen() and DestroyPixmap() vfunc handlers in
    case of failure when checking for the minimum requirements, so that if
    any of the requirement is not met we don't leave the CloseScreen() and
    DestroyPixmap() from glamor handlers in place.
    
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1390018
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/glamor/glamor.c b/glamor/glamor.c
index b771832..c54cf3b 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -470,7 +470,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
         LogMessage(X_WARNING,
                    "glamor%d: Failed to allocate screen private\n",
                    screen->myNum);
-        goto fail;
+        goto free_glamor_private;
     }
 
     glamor_set_screen_private(screen, glamor_priv);
@@ -480,7 +480,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
         LogMessage(X_WARNING,
                    "glamor%d: Failed to allocate pixmap private\n",
                    screen->myNum);
-        goto fail;
+        goto free_glamor_private;
     }
 
     if (!dixRegisterPrivateKey(&glamor_gc_private_key, PRIVATE_GC,
@@ -488,7 +488,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
         LogMessage(X_WARNING,
                    "glamor%d: Failed to allocate gc private\n",
                    screen->myNum);
-        goto fail;
+        goto free_glamor_private;
     }
 
     glamor_priv->saved_procs.close_screen = screen->CloseScreen;
@@ -731,6 +731,11 @@ glamor_init(ScreenPtr screen, unsigned int flags)
     return TRUE;
 
  fail:
+    /* Restore default CloseScreen and DestroyPixmap handlers */
+    screen->CloseScreen = glamor_priv->saved_procs.close_screen;
+    screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap;
+
+ free_glamor_private:
     free(glamor_priv);
     glamor_set_screen_private(screen, NULL);
     return FALSE;


More information about the xorg-commit mailing list