xserver: Branch 'server-1.14-branch' - 7 commits

Matt Dew marcoz at kemper.freedesktop.org
Mon May 6 20:36:38 PDT 2013


 Xi/devbell.c                               |    3 +-
 Xi/exevents.c                              |   42 +++++++++++++++--------------
 Xi/extinit.c                               |   36 ++++++++++++------------
 Xi/xigrabdev.c                             |   15 ++++++++--
 dix/eventconvert.c                         |   19 ++++++-------
 dix/touch.c                                |    4 +-
 hw/xfree86/os-support/linux/lnx_platform.c |    3 --
 7 files changed, 68 insertions(+), 54 deletions(-)

New commits:
commit a11cf8dd68275ba4676888e5957bff13efbfbb3d
Author: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Date:   Mon Apr 15 16:53:48 2013 +0200

    dix: copy event in TouchConvertToPointerEvent correctly
    
    Fixes reading random memory read beyond the end of original event.
    
    sizeof device_event: 424
    sizeof internal_event: 2800
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 98b94c36d6b1d286bbd4cb414e54b4b95a1484b0)

diff --git a/dix/touch.c b/dix/touch.c
index 891cc78..3027bbb 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -620,14 +620,14 @@ TouchConvertToPointerEvent(const InternalEvent *event,
     BUG_WARN_MSG(!(event->device_event.flags & TOUCH_POINTER_EMULATED),
                  "Non-emulating touch event\n");
 
-    *motion_event = *event;
+    motion_event->device_event = event->device_event;
     motion_event->any.type = ET_Motion;
     motion_event->device_event.detail.button = 0;
     motion_event->device_event.flags = XIPointerEmulated;
 
     if (nevents > 1) {
         BUG_RETURN_VAL(!button_event, 0);
-        *button_event = *event;
+        button_event->device_event = event->device_event;
         button_event->any.type = ptrtype;
         button_event->device_event.flags = XIPointerEmulated;
         /* detail is already correct */
commit 05ca549d81f476561257076f354c781d590c9a4f
Author: Knut Petersen <Knut_Petersen at t-online.de>
Date:   Tue Feb 26 07:52:59 2013 +0100

    Never try to execute BellProcPtr NULL.
    
    This prevents xts XI/XDeviceBell-2 test
    from segfaulting the server.
    
    Signed-off-by: Knut Petersen <Knut_Petersen at t-online.de>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 4bff442ec5aa4b93a3f5c11782d4b7b9d1ae13ac)

diff --git a/Xi/devbell.c b/Xi/devbell.c
index c75b94d..202c8de 100644
--- a/Xi/devbell.c
+++ b/Xi/devbell.c
@@ -142,7 +142,8 @@ ProcXDeviceBell(ClientPtr client)
         newpercent = base + newpercent;
     else
         newpercent = base - newpercent + stuff->percent;
+    if (proc == NULL)
+        return BadValue;
     (*proc) (newpercent, dev, ctrl, class);
-
     return Success;
 }
commit 2cc81338d1804a6a6c92f48773d3e1b2543a262b
Author: Rui Matos <tiagomatos at gmail.com>
Date:   Sat Apr 13 04:22:54 2013 +0200

    Xi: fix swapped grab mode args for keyboard devices in XIGrabDevice
    
    The protocol says that the grab_mode argument applies to the device
    being grabbed and paired_device_mode to the paired master
    device. GrabDevice() however takes in a pointer mode and a keyboard
    mode and so we have to swap the values according the type of device
    being grabbed.
    
    Signed-off-by: Rui Matos <tiagomatos at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 9003399708936481083424b4ff8f18a16b88b7b3)

diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c
index 09186e8..63d95bc 100644
--- a/Xi/xigrabdev.c
+++ b/Xi/xigrabdev.c
@@ -67,6 +67,8 @@ ProcXIGrabDevice(ClientPtr client)
     uint8_t status;
     GrabMask mask = { 0 };
     int mask_len;
+    unsigned int keyboard_mode;
+    unsigned int pointer_mode;
 
     REQUEST(xXIGrabDeviceReq);
     REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq);
@@ -78,6 +80,15 @@ ProcXIGrabDevice(ClientPtr client)
     if (!IsMaster(dev))
         stuff->paired_device_mode = GrabModeAsync;
 
+    if (IsKeyboardDevice(dev)) {
+        keyboard_mode = stuff->grab_mode;
+        pointer_mode = stuff->paired_device_mode;
+    }
+    else {
+        keyboard_mode = stuff->paired_device_mode;
+        pointer_mode = stuff->grab_mode;
+    }
+
     if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1],
                                stuff->mask_len * 4) != Success)
         return BadValue;
@@ -91,8 +102,8 @@ ProcXIGrabDevice(ClientPtr client)
     xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char *) &stuff[1],
                          mask_len);
 
-    ret = GrabDevice(client, dev, stuff->grab_mode,
-                     stuff->paired_device_mode,
+    ret = GrabDevice(client, dev, pointer_mode,
+                     keyboard_mode,
                      stuff->grab_window,
                      stuff->owner_events,
                      stuff->time,
commit 08998230789ff15843f726d7231ec0de2f67be6b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Apr 12 09:14:53 2013 +1000

    xfree86: change a log message
    
    This path is technically executed through config/udev, but having two
    messages in the form "config/udev: Adding drm device" makes it appear as if
    the udev filters are wrong and it's trying to add the same device twice. In
    fact, it's only one device, only added once, but a duplicate log message.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 131f883f85b9b734e5e5652f16ba1d3b5f4de12f)

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 76f5583..2bc8214 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -116,8 +116,7 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
     if (i != xf86_num_platform_devices)
         goto out_free;
 
-    LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n",
-               path);
+    LogMessage(X_INFO, "xfree86: Adding drm device (%s)\n", path);
 
     ret = get_drm_info(attribs, path);
     if (ret == FALSE)
commit 2c9ac2689fc75cfa3293316acd51b9a39f37edfd
Author: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Date:   Tue Apr 9 11:19:07 2013 +0200

    Xi: Do not handle ET_TouchOwnership in ProcessTouchEvent
    
    The event struct is different, causing memory corruption on 1.13 and 1.14,
    
    as can be witnessed in https://bugs.freedesktop.org/show_bug.cgi?id=56578
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 7347f39f94d8cebbf73ce1a2f94d1abdaf7ff383)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index f05e03d..d39cf89 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1221,9 +1221,16 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
  * touchpoint if it is pending finish.
  */
 static void
-ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
-                           TouchOwnershipEvent *ev)
+ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
+                           DeviceIntPtr dev)
 {
+    TouchPointInfoPtr ti = TouchFindByClientID(dev, ev->touchid);
+
+    if (!ti) {
+        DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n",
+               dev->name, ev->type, ev->touchid);
+        return;
+    }
 
     if (ev->reason == XIRejectTouch)
         TouchRejected(dev, ti, ev->resource, ev);
@@ -1536,10 +1543,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     if (!t)
         return;
 
-    if (ev->any.type == ET_TouchOwnership)
-        touchid = ev->touch_ownership_event.touchid;
-    else
-        touchid = ev->device_event.touchid;
+    touchid = ev->device_event.touchid;
 
     if (type == ET_TouchBegin) {
         ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
@@ -1612,19 +1616,13 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
         (type != ET_TouchEnd && ti->sprite.spriteTraceGood == 0))
         return;
 
-    /* TouchOwnership events are handled separately from the rest, as they
-     * have more complex semantics. */
-    if (ev->any.type == ET_TouchOwnership)
-        ProcessTouchOwnershipEvent(dev, ti, &ev->touch_ownership_event);
-    else {
-        TouchCopyValuatorData(&ev->device_event, ti);
-        /* WARNING: the event type may change to TouchUpdate in
-         * DeliverTouchEvents if a TouchEnd was delivered to a grabbing
-         * owner */
-        DeliverTouchEvents(dev, ti, (InternalEvent *) ev, 0);
-        if (ev->any.type == ET_TouchEnd)
-            TouchEndTouch(dev, ti);
-    }
+    TouchCopyValuatorData(&ev->device_event, ti);
+    /* WARNING: the event type may change to TouchUpdate in
+     * DeliverTouchEvents if a TouchEnd was delivered to a grabbing
+     * owner */
+    DeliverTouchEvents(dev, ti, (InternalEvent *) ev, 0);
+    if (ev->any.type == ET_TouchEnd)
+        TouchEndTouch(dev, ti);
 
     if (emulate_pointer)
         UpdateDeviceState(dev, &ev->device_event);
@@ -1818,10 +1816,14 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
         break;
     case ET_TouchBegin:
     case ET_TouchUpdate:
-    case ET_TouchOwnership:
     case ET_TouchEnd:
         ProcessTouchEvent(ev, device);
         break;
+    case ET_TouchOwnership:
+        /* TouchOwnership events are handled separately from the rest, as they
+         * have more complex semantics. */
+        ProcessTouchOwnershipEvent(&ev->touch_ownership_event, device);
+        break;
     case ET_BarrierHit:
     case ET_BarrierLeave:
         ProcessBarrierEvent(ev, device);
commit 0a3630708b729a02cefc342456b243254f5b699d
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Apr 9 16:23:19 2013 -0700

    Xi: Use correct destination when swapping barrier events
    
    Write the swapped values to the destination rather than the source.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Jasper St. Pierre <jstpierre at mecheye.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit dbba50a1280cbda9ecff6f37884b4c5756c30bab)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 619d0e4..02fffe5 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -848,24 +848,24 @@ SBarrierEvent(xXIBarrierEvent * from,
 
     *to = *from;
 
-    swaps(&from->sequenceNumber);
-    swapl(&from->length);
-    swaps(&from->evtype);
-    swapl(&from->time);
-    swaps(&from->deviceid);
-    swaps(&from->sourceid);
-    swapl(&from->event);
-    swapl(&from->root);
-    swapl(&from->root_x);
-    swapl(&from->root_y);
-
-    swapl(&from->dx.integral);
-    swapl(&from->dx.frac);
-    swapl(&from->dy.integral);
-    swapl(&from->dy.frac);
-    swapl(&from->dtime);
-    swapl(&from->barrier);
-    swapl(&from->eventid);
+    swaps(&to->sequenceNumber);
+    swapl(&to->length);
+    swaps(&to->evtype);
+    swapl(&to->time);
+    swaps(&to->deviceid);
+    swaps(&to->sourceid);
+    swapl(&to->event);
+    swapl(&to->root);
+    swapl(&to->root_x);
+    swapl(&to->root_y);
+
+    swapl(&to->dx.integral);
+    swapl(&to->dx.frac);
+    swapl(&to->dy.integral);
+    swapl(&to->dy.frac);
+    swapl(&to->dtime);
+    swapl(&to->barrier);
+    swapl(&to->eventid);
 }
 
 /** Event swapping function for XI2 events. */
commit 9ad9c1358567998564d177f06d98fc46dcb41009
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Mar 4 07:58:41 2013 +1000

    dix: don't set non-exisiting flags on touch events
    
    Unlike pointer/keyboard events, the flags field for ET_Touch* is a set of
    server-internal defines that we need to convert to XI protocol defines.
    Currently only two of those defines actually translate to the protocol, so
    make sure we don't send internal garbage down the wire.
    
    No effect to current clients since they shouldn't look at undefined bits
    anyway.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit b86b3d10bb2fee1a922b8831e8bb415c339f3d99)

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 2c411cf..ebc52c3 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -684,17 +684,18 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
     xde->root_x = double_to_fp1616(ev->root_x + ev->root_x_frac);
     xde->root_y = double_to_fp1616(ev->root_y + ev->root_y_frac);
 
-    if (ev->type == ET_TouchUpdate)
-        xde->flags |= (ev->flags & TOUCH_PENDING_END) ? XITouchPendingEnd : 0;
-    else
-        xde->flags = ev->flags;
+    if (IsTouchEvent((InternalEvent *)ev)) {
+        if (ev->type == ET_TouchUpdate)
+            xde->flags |= (ev->flags & TOUCH_PENDING_END) ? XITouchPendingEnd : 0;
 
-    if (IsTouchEvent((InternalEvent *) ev) &&
-        ev->flags & TOUCH_POINTER_EMULATED)
-        xde->flags |= XITouchEmulatingPointer;
+        if (ev->flags & TOUCH_POINTER_EMULATED)
+            xde->flags |= XITouchEmulatingPointer;
+    } else {
+        xde->flags = ev->flags;
 
-    if (ev->key_repeat)
-        xde->flags |= XIKeyRepeat;
+        if (ev->key_repeat)
+            xde->flags |= XIKeyRepeat;
+    }
 
     xde->mods.base_mods = ev->mods.base;
     xde->mods.latched_mods = ev->mods.latched;


More information about the xorg-commit mailing list