From 63fb458332cb824d2ce28440e50922dfddd9c743 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Fri, 7 Nov 2025 14:13:56 +0100 Subject: [PATCH] xwayland 24.1.9 Resolves: https://issues.redhat.com/browse/RHEL-120264 --- ...ursor-Refuse-to-free-the-root-cursor.patch | 55 -------- ...-Don-t-run-key-behaviors-and-actions.patch | 106 -------------- ...after-free-in-present_create_notifie.patch | 88 ------------ ...der-Avoid-0-or-less-animated-cursors.patch | 89 ------------ 0002-dix-keep-a-ref-to-the-rootCursor.patch | 49 ------- ...low-the-integer-size-with-BigRequest.patch | 90 ------------ ...ke-the-RT_XKBCLIENT-resource-private.patch | 59 -------- ...nteger-overflow-on-BigRequest-length.patch | 34 ----- ...x-buffer-overflow-in-XkbVModMaskText.patch | 63 --------- ...KB-resource-when-freeing-XkbInterest.patch | 89 ------------ ...uest-length-for-SetClientDisconnectM.patch | 52 ------- ...kb-Fix-computation-of-XkbSizeKeySyms.patch | 47 ------- ...-Prevent-overflow-in-XkbSetCompatMap.patch | 49 ------- ...ytes-to-ignore-when-sharing-input-bu.patch | 47 ------- ...ffer-overflow-in-XkbChangeTypesOfKey.patch | 45 ------ 0006-Xi-Fix-barrier-device-search.patch | 118 ---------------- ...-overflow-in-RecordSanityCheckRegist.patch | 64 --------- ...-failure-to-redirect-in-compRedirect.patch | 65 --------- ...overflow-in-RRChangeProviderProperty.patch | 42 ------ ...lize-border-clip-even-when-pixmap-al.patch | 127 ----------------- ...ing-events-on-frozen-device-on-remov.patch | 67 --------- ...o-not-let-sync-objects-uninitialized.patch | 69 --------- ...Check-values-before-applying-changes.patch | 83 ----------- ...-not-fail-SyncAddTriggerToSyncObject.patch | 50 ------- ...es-last-in-SyncChangeAlarmAttributes.patch | 131 ------------------ sources | 2 +- xorg-x11-server-Xwayland.spec | 52 +------ 27 files changed, 6 insertions(+), 1826 deletions(-) delete mode 100644 0001-Cursor-Refuse-to-free-the-root-cursor.patch delete mode 100644 0001-Revert-xwayland-Don-t-run-key-behaviors-and-actions.patch delete mode 100644 0001-present-Fix-use-after-free-in-present_create_notifie.patch delete mode 100644 0001-render-Avoid-0-or-less-animated-cursors.patch delete mode 100644 0002-dix-keep-a-ref-to-the-rootCursor.patch delete mode 100644 0002-os-Do-not-overflow-the-integer-size-with-BigRequest.patch delete mode 100644 0002-xkb-Make-the-RT_XKBCLIENT-resource-private.patch delete mode 100644 0003-os-Check-for-integer-overflow-on-BigRequest-length.patch delete mode 100644 0003-xkb-Fix-buffer-overflow-in-XkbVModMaskText.patch delete mode 100644 0003-xkb-Free-the-XKB-resource-when-freeing-XkbInterest.patch delete mode 100644 0004-xfixes-Check-request-length-for-SetClientDisconnectM.patch delete mode 100644 0004-xkb-Fix-computation-of-XkbSizeKeySyms.patch delete mode 100644 0004-xkb-Prevent-overflow-in-XkbSetCompatMap.patch delete mode 100644 0005-os-Account-for-bytes-to-ignore-when-sharing-input-bu.patch delete mode 100644 0005-xkb-Fix-buffer-overflow-in-XkbChangeTypesOfKey.patch delete mode 100644 0006-Xi-Fix-barrier-device-search.patch delete mode 100644 0006-record-Check-for-overflow-in-RecordSanityCheckRegist.patch delete mode 100644 0007-composite-Handle-failure-to-redirect-in-compRedirect.patch delete mode 100644 0007-randr-Check-for-overflow-in-RRChangeProviderProperty.patch delete mode 100644 0008-composite-initialize-border-clip-even-when-pixmap-al.patch delete mode 100644 0009-dix-Dequeue-pending-events-on-frozen-device-on-remov.patch delete mode 100644 0010-sync-Do-not-let-sync-objects-uninitialized.patch delete mode 100644 0011-sync-Check-values-before-applying-changes.patch delete mode 100644 0012-sync-Do-not-fail-SyncAddTriggerToSyncObject.patch delete mode 100644 0013-sync-Apply-changes-last-in-SyncChangeAlarmAttributes.patch diff --git a/0001-Cursor-Refuse-to-free-the-root-cursor.patch b/0001-Cursor-Refuse-to-free-the-root-cursor.patch deleted file mode 100644 index 916a743..0000000 --- a/0001-Cursor-Refuse-to-free-the-root-cursor.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 543708ae9342d59694f53023c037db324eee0d14 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 27 Nov 2024 11:27:05 +0100 -Subject: [PATCH xserver 01/13] Cursor: Refuse to free the root cursor -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If a cursor reference count drops to 0, the cursor is freed. - -The root cursor however is referenced with a specific global variable, -and when the root cursor is freed, the global variable may still point -to freed memory. - -Make sure to prevent the rootCursor from being explicitly freed by a -client. - -CVE-2025-26594, ZDI-CAN-25544 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -v2: Explicitly forbid XFreeCursor() on the root cursor (Peter Hutterer -) -v3: Return BadCursor instead of BadValue (Michel Dänzer -) - -Signed-off-by: Olivier Fourdan -Suggested-by: Peter Hutterer -Reviewed-by: Peter Hutterer -(cherry picked from commit 01642f263f12becf803b19be4db95a4a83f94acc) - -Part-of: ---- - dix/dispatch.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/dix/dispatch.c b/dix/dispatch.c -index 41dffd631..29a2415d9 100644 ---- a/dix/dispatch.c -+++ b/dix/dispatch.c -@@ -3106,6 +3106,10 @@ ProcFreeCursor(ClientPtr client) - rc = dixLookupResourceByType((void **) &pCursor, stuff->id, RT_CURSOR, - client, DixDestroyAccess); - if (rc == Success) { -+ if (pCursor == rootCursor) { -+ client->errorValue = stuff->id; -+ return BadCursor; -+ } - FreeResource(stuff->id, RT_NONE); - return Success; - } --- -2.48.1 - diff --git a/0001-Revert-xwayland-Don-t-run-key-behaviors-and-actions.patch b/0001-Revert-xwayland-Don-t-run-key-behaviors-and-actions.patch deleted file mode 100644 index e06d8e4..0000000 --- a/0001-Revert-xwayland-Don-t-run-key-behaviors-and-actions.patch +++ /dev/null @@ -1,106 +0,0 @@ -From f04096af3cb7fe28914a1248498da3dc757fd73d Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 10 Feb 2025 15:38:18 +0100 -Subject: [PATCH xserver] Revert "xwayland: Don't run key behaviors and - actions" - -Due to a bug in gamescope who does not send the Wayland modifiers -events, this is causing a regression in X11 clients running on Xwayland -in gamescope, where the modifiers are not applied anymore. - -This reverts commit cea92a3e0900eb611b2e683edf11272d4e306a77. - -Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1790 -See-also: https://github.com/ValveSoftware/gamescope/issues/1740 -Part-of: ---- - hw/xwayland/xwayland-input.c | 7 ++----- - include/inputstr.h | 2 -- - xkb/xkbActions.c | 9 +++------ - xkb/xkbPrKeyEv.c | 2 +- - 4 files changed, 6 insertions(+), 14 deletions(-) - -diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c -index 41434a89a..53cc5144b 100644 ---- a/hw/xwayland/xwayland-input.c -+++ b/hw/xwayland/xwayland-input.c -@@ -1284,12 +1284,11 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, - old_state = dev->key->xkbInfo->state; - new_state = &dev->key->xkbInfo->state; - -- new_state->base_group = 0; -- new_state->latched_group = 0; - new_state->locked_group = group & XkbAllGroupsMask; - new_state->base_mods = mods_depressed & XkbAllModifiersMask; -- new_state->latched_mods = mods_latched & XkbAllModifiersMask; - new_state->locked_mods = mods_locked & XkbAllModifiersMask; -+ XkbLatchModifiers(dev, XkbAllModifiersMask, -+ mods_latched & XkbAllModifiersMask); - - XkbComputeDerivedState(dev->key->xkbInfo); - -@@ -1677,7 +1676,6 @@ add_device(struct xwl_seat *xwl_seat, - dev->public.devicePrivate = xwl_seat; - dev->type = SLAVE; - dev->spriteInfo->spriteOwner = FALSE; -- dev->ignoreXkbActionsBehaviors = TRUE; - - return dev; - } -@@ -3599,7 +3597,6 @@ InitInput(int argc, char *argv[]) - - mieqInit(); - -- inputInfo.keyboard->ignoreXkbActionsBehaviors = TRUE; - xwl_screen->input_registry = wl_display_get_registry(xwl_screen->display); - wl_registry_add_listener(xwl_screen->input_registry, &input_listener, - xwl_screen); -diff --git a/include/inputstr.h b/include/inputstr.h -index 269399e1d..24dd48841 100644 ---- a/include/inputstr.h -+++ b/include/inputstr.h -@@ -631,8 +631,6 @@ typedef struct _DeviceIntRec { - DeviceSendEventsProc sendEventsProc; - - struct _SyncCounter *idle_counter; -- -- Bool ignoreXkbActionsBehaviors; /* TRUE if keys don't trigger behaviors and actions */ - } DeviceIntRec; - - typedef struct { -diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c -index 8dd9d7da0..5e9a6b6d6 100644 ---- a/xkb/xkbActions.c -+++ b/xkb/xkbActions.c -@@ -1368,12 +1368,9 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) - (event->type == ET_ButtonPress)); - - if (pressEvent) { -- if (keyEvent) { -- if (kbd->ignoreXkbActionsBehaviors) -- act.type = XkbSA_NoAction; -- else -- act = XkbGetKeyAction(xkbi, &xkbi->state, key); -- } else { -+ if (keyEvent) -+ act = XkbGetKeyAction(xkbi, &xkbi->state, key); -+ else { - act = XkbGetButtonAction(kbd, dev, key); - key |= BTN_ACT_FLAG; - } -diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c -index 53a31b727..d2c7e33f4 100644 ---- a/xkb/xkbPrKeyEv.c -+++ b/xkb/xkbPrKeyEv.c -@@ -68,7 +68,7 @@ XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr keybd) - /* do anything to implement the behavior, but it *does* report that */ - /* key is hardwired */ - -- if (!keybd->ignoreXkbActionsBehaviors && !(behavior.type & XkbKB_Permanent)) { -+ if (!(behavior.type & XkbKB_Permanent)) { - switch (behavior.type) { - case XkbKB_Default: - /* Neither of these should happen in practice, but ignore them --- -2.48.1 - diff --git a/0001-present-Fix-use-after-free-in-present_create_notifie.patch b/0001-present-Fix-use-after-free-in-present_create_notifie.patch deleted file mode 100644 index 7b164fa..0000000 --- a/0001-present-Fix-use-after-free-in-present_create_notifie.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 4d07b16328bc9c9d4f6c4c1a9a522d64bf09deda Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 2 Jul 2025 09:46:22 +0200 -Subject: [PATCH xserver 1/4] present: Fix use-after-free in - present_create_notifies() - -Using the Present extension, if an error occurs while processing and -adding the notifications after presenting a pixmap, the function -present_create_notifies() will clean up and remove the notifications -it added. - -However, there are two different code paths that can lead to an error -creating the notify, one being before the notify is being added to the -list, and another one after the notify is added. - -When the error occurs before it's been added, it removes the elements up -to the last added element, instead of the actual number of elements -which were added. - -As a result, in case of error, as with an invalid window for example, it -leaves a dangling pointer to the last element, leading to a use after -free case later: - - | Invalid write of size 8 - | at 0x5361D5: present_clear_window_notifies (present_notify.c:42) - | by 0x534A56: present_destroy_window (present_screen.c:107) - | by 0x41E441: xwl_destroy_window (xwayland-window.c:1959) - | by 0x4F9EC9: compDestroyWindow (compwindow.c:622) - | by 0x51EAC4: damageDestroyWindow (damage.c:1592) - | by 0x4FDC29: DbeDestroyWindow (dbe.c:1291) - | by 0x4EAC55: FreeWindowResources (window.c:1023) - | by 0x4EAF59: DeleteWindow (window.c:1091) - | by 0x4DE59A: doFreeResource (resource.c:890) - | by 0x4DEFB2: FreeClientResources (resource.c:1156) - | by 0x4A9AFB: CloseDownClient (dispatch.c:3567) - | by 0x5DCC78: ClientReady (connection.c:603) - | Address 0x16126200 is 16 bytes inside a block of size 2,048 free'd - | at 0x4841E43: free (vg_replace_malloc.c:989) - | by 0x5363DD: present_destroy_notifies (present_notify.c:111) - | by 0x53638D: present_create_notifies (present_notify.c:100) - | by 0x5368E9: proc_present_pixmap_common (present_request.c:164) - | by 0x536A7D: proc_present_pixmap (present_request.c:189) - | by 0x536FA9: proc_present_dispatch (present_request.c:337) - | by 0x4A1E4E: Dispatch (dispatch.c:561) - | by 0x4B00F1: dix_main (main.c:284) - | by 0x42879D: main (stubmain.c:34) - | Block was alloc'd at - | at 0x48463F3: calloc (vg_replace_malloc.c:1675) - | by 0x5362A1: present_create_notifies (present_notify.c:81) - | by 0x5368E9: proc_present_pixmap_common (present_request.c:164) - | by 0x536A7D: proc_present_pixmap (present_request.c:189) - | by 0x536FA9: proc_present_dispatch (present_request.c:337) - | by 0x4A1E4E: Dispatch (dispatch.c:561) - | by 0x4B00F1: dix_main (main.c:284) - | by 0x42879D: main (stubmain.c:34) - -To fix the issue, count and remove the actual number of notify elements -added in case of error. - -CVE-2025-62229, ZDI-CAN-27238 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -(cherry picked from commit 5a4286b13f631b66c20f5bc8db7b68211dcbd1d0) - -Part-of: ---- - present/present_notify.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/present/present_notify.c b/present/present_notify.c -index 445954998..00b3b68bd 100644 ---- a/present/present_notify.c -+++ b/present/present_notify.c -@@ -90,7 +90,7 @@ present_create_notifies(ClientPtr client, int num_notifies, xPresentNotify *x_no - if (status != Success) - goto bail; - -- added = i; -+ added++; - } - return Success; - --- -2.51.1 - diff --git a/0001-render-Avoid-0-or-less-animated-cursors.patch b/0001-render-Avoid-0-or-less-animated-cursors.patch deleted file mode 100644 index 404291f..0000000 --- a/0001-render-Avoid-0-or-less-animated-cursors.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 4f5d7674a2bacf8ada9dbbe0c2392af655fc7192 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Fri, 28 Mar 2025 09:43:52 +0100 -Subject: [PATCH 1/7] render: Avoid 0 or less animated cursors -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Animated cursors use a series of cursors that the client can set. - -By default, the Xserver assumes at least one cursor is specified -while a client may actually pass no cursor at all. - -That causes an out-of-bound read creating the animated cursor and a -crash of the Xserver: - - | Invalid read of size 8 - | at 0x5323F4: AnimCursorCreate (animcur.c:325) - | by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817) - | by 0x52DC80: ProcRenderDispatch (render.c:1999) - | by 0x4A1E9D: Dispatch (dispatch.c:560) - | by 0x4B0169: dix_main (main.c:284) - | by 0x4287F5: main (stubmain.c:34) - | Address 0x59aa010 is 0 bytes after a block of size 0 alloc'd - | at 0x48468D3: reallocarray (vg_replace_malloc.c:1803) - | by 0x52D3DA: ProcRenderCreateAnimCursor (render.c:1802) - | by 0x52DC80: ProcRenderDispatch (render.c:1999) - | by 0x4A1E9D: Dispatch (dispatch.c:560) - | by 0x4B0169: dix_main (main.c:284) - | by 0x4287F5: main (stubmain.c:34) - | - | Invalid read of size 2 - | at 0x5323F7: AnimCursorCreate (animcur.c:325) - | by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817) - | by 0x52DC80: ProcRenderDispatch (render.c:1999) - | by 0x4A1E9D: Dispatch (dispatch.c:560) - | by 0x4B0169: dix_main (main.c:284) - | by 0x4287F5: main (stubmain.c:34) - | Address 0x8 is not stack'd, malloc'd or (recently) free'd - -To avoid the issue, check the number of cursors specified and return a -BadValue error in both the proc handler (early) and the animated cursor -creation (as this is a public function) if there is 0 or less cursor. - -CVE-2025-49175 - -This issue was discovered by Nils Emmerich and -reported by Julian Suleder via ERNW Vulnerability Disclosure. - -Signed-off-by: Olivier Fourdan -Reviewed-by: José Expósito -(cherry picked from commit 0885e0b26225c90534642fe911632ec0779eebee) - -Part-of: ---- - render/animcur.c | 3 +++ - render/render.c | 2 ++ - 2 files changed, 5 insertions(+) - -diff --git a/render/animcur.c b/render/animcur.c -index eb8b817..a53e2a4 100644 ---- a/render/animcur.c -+++ b/render/animcur.c -@@ -304,6 +304,9 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor, - int rc = BadAlloc, i; - AnimCurPtr ac; - -+ if (ncursor <= 0) -+ return BadValue; -+ - for (i = 0; i < screenInfo.numScreens; i++) - if (!GetAnimCurScreen(screenInfo.screens[i])) - return BadImplementation; -diff --git a/render/render.c b/render/render.c -index fe5e37d..69d99c2 100644 ---- a/render/render.c -+++ b/render/render.c -@@ -1795,6 +1795,8 @@ ProcRenderCreateAnimCursor(ClientPtr client) - ncursor = - (client->req_len - - (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1; -+ if (ncursor <= 0) -+ return BadValue; - cursors = xallocarray(ncursor, sizeof(CursorPtr) + sizeof(CARD32)); - if (!cursors) - return BadAlloc; --- -2.49.0 - diff --git a/0002-dix-keep-a-ref-to-the-rootCursor.patch b/0002-dix-keep-a-ref-to-the-rootCursor.patch deleted file mode 100644 index d56a2a8..0000000 --- a/0002-dix-keep-a-ref-to-the-rootCursor.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 80f8d0b8e2214b2363afadbc8da3913f59333c8b Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 4 Dec 2024 15:49:43 +1000 -Subject: [PATCH xserver 02/13] dix: keep a ref to the rootCursor - -CreateCursor returns a cursor with refcount 1 - that refcount is used by -the resource system, any caller needs to call RefCursor to get their own -reference. That happens correctly for normal cursors but for our -rootCursor we keep a variable to the cursor despite not having a ref for -ourselves. - -Fix this by reffing/unreffing the rootCursor to ensure our pointer is -valid. - -Related to CVE-2025-26594, ZDI-CAN-25544 - -Reviewed-by: Olivier Fourdan -(cherry picked from commit b0a09ba6020147961acc62d9c73d807b4cccd9f7) - -Part-of: ---- - dix/main.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/dix/main.c b/dix/main.c -index 4980bd6cb..0fa196427 100644 ---- a/dix/main.c -+++ b/dix/main.c -@@ -234,6 +234,8 @@ dix_main(int argc, char *argv[], char *envp[]) - FatalError("could not open default cursor font"); - } - -+ rootCursor = RefCursor(rootCursor); -+ - #ifdef PANORAMIX - /* - * Consolidate window and colourmap information for each screen -@@ -274,6 +276,8 @@ dix_main(int argc, char *argv[], char *envp[]) - - Dispatch(); - -+ UnrefCursor(rootCursor); -+ - UndisplayDevices(); - DisableAllDevices(); - --- -2.48.1 - diff --git a/0002-os-Do-not-overflow-the-integer-size-with-BigRequest.patch b/0002-os-Do-not-overflow-the-integer-size-with-BigRequest.patch deleted file mode 100644 index 73a5ec7..0000000 --- a/0002-os-Do-not-overflow-the-integer-size-with-BigRequest.patch +++ /dev/null @@ -1,90 +0,0 @@ -From e811c92cecc2796f4d2e755632184a816eea45fe Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 7 Apr 2025 16:13:34 +0200 -Subject: [PATCH 2/7] os: Do not overflow the integer size with BigRequest -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The BigRequest extension allows requests larger than the 16-bit length -limit. - -It uses integers for the request length and checks for the size not to -exceed the maxBigRequestSize limit, but does so after translating the -length to integer by multiplying the given size in bytes by 4. - -In doing so, it might overflow the integer size limit before actually -checking for the overflow, defeating the purpose of the test. - -To avoid the issue, make sure to check that the request size does not -overflow the maxBigRequestSize limit prior to any conversion. - -The caller Dispatch() function however expects the return value to be in -bytes, so we cannot just return the converted value in case of error, as -that would also overflow the integer size. - -To preserve the existing API, we use a negative value for the X11 error -code BadLength as the function only return positive values, 0 or -1 and -update the caller Dispatch() function to take that case into account to -return the error code to the offending client. - -CVE-2025-49176 - -This issue was discovered by Nils Emmerich and -reported by Julian Suleder via ERNW Vulnerability Disclosure. - -Signed-off-by: Olivier Fourdan -Reviewed-by: Michel Dänzer -(cherry picked from commit 03731b326a80b582e48d939fe62cb1e2b10400d9) - -Part-of: ---- - dix/dispatch.c | 9 +++++---- - os/io.c | 4 ++++ - 2 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/dix/dispatch.c b/dix/dispatch.c -index 29a2415..7fc3a05 100644 ---- a/dix/dispatch.c -+++ b/dix/dispatch.c -@@ -517,9 +517,10 @@ Dispatch(void) - - /* now, finally, deal with client requests */ - result = ReadRequestFromClient(client); -- if (result <= 0) { -- if (result < 0) -- CloseDownClient(client); -+ if (result == 0) -+ break; -+ else if (result == -1) { -+ CloseDownClient(client); - break; - } - -@@ -540,7 +541,7 @@ Dispatch(void) - client->index, - client->requestBuffer); - #endif -- if (result > (maxBigRequestSize << 2)) -+ if (result < 0 || result > (maxBigRequestSize << 2)) - result = BadLength; - else { - result = XaceHookDispatch(client, client->majorOp); -diff --git a/os/io.c b/os/io.c -index 1e9258c..9e483ae 100644 ---- a/os/io.c -+++ b/os/io.c -@@ -299,6 +299,10 @@ ReadRequestFromClient(ClientPtr client) - needed = get_big_req_len(request, client); - } - client->req_len = needed; -+ if (needed > MAXINT >> 2) { -+ /* Check for potential integer overflow */ -+ return -(BadLength); -+ } - needed <<= 2; /* needed is in bytes now */ - } - if (gotnow < needed) { --- -2.49.0 - diff --git a/0002-xkb-Make-the-RT_XKBCLIENT-resource-private.patch b/0002-xkb-Make-the-RT_XKBCLIENT-resource-private.patch deleted file mode 100644 index 36e1907..0000000 --- a/0002-xkb-Make-the-RT_XKBCLIENT-resource-private.patch +++ /dev/null @@ -1,59 +0,0 @@ -From a1d4f04bbd46957af854bea3b23d0dcb31b38afd Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 10 Sep 2025 15:55:06 +0200 -Subject: [PATCH xserver 2/4] xkb: Make the RT_XKBCLIENT resource private -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Currently, the resource in only available to the xkb.c source file. - -In preparation for the next commit, to be able to free the resources -from XkbRemoveResourceClient(), make that variable private instead. - -This is related to: - -CVE-2025-62230, ZDI-CAN-27545 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Michel Dänzer -(cherry picked from commit 99790a2c9205a52fbbec01f21a92c9b7f4ed1d8f) - -Part-of: ---- - include/xkbsrv.h | 2 ++ - xkb/xkb.c | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/include/xkbsrv.h b/include/xkbsrv.h -index bd747856b..d801cd4b8 100644 ---- a/include/xkbsrv.h -+++ b/include/xkbsrv.h -@@ -58,6 +58,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. - #include "inputstr.h" - #include "events.h" - -+extern RESTYPE RT_XKBCLIENT; -+ - typedef struct _XkbInterest { - DeviceIntPtr dev; - ClientPtr client; -diff --git a/xkb/xkb.c b/xkb/xkb.c -index ac154e200..6c102af0a 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -50,7 +50,7 @@ int XkbKeyboardErrorCode; - CARD32 xkbDebugFlags = 0; - static CARD32 xkbDebugCtrls = 0; - --static RESTYPE RT_XKBCLIENT; -+RESTYPE RT_XKBCLIENT = 0; - - /***====================================================================***/ - --- -2.51.1 - diff --git a/0003-os-Check-for-integer-overflow-on-BigRequest-length.patch b/0003-os-Check-for-integer-overflow-on-BigRequest-length.patch deleted file mode 100644 index 2423c15..0000000 --- a/0003-os-Check-for-integer-overflow-on-BigRequest-length.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 9d73f2efada9c06898a04f3500eb98fa73d01887 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 18 Jun 2025 08:39:02 +0200 -Subject: [PATCH 3/7] os: Check for integer overflow on BigRequest length - -Check for another possible integer overflow once we get a complete xReq -with BigRequest. - -Related to CVE-2025-49176 - -Signed-off-by: Olivier Fourdan -Suggested-by: Peter Harris -Part-of: -(cherry picked from commit 4fc4d76b2c7aaed61ed2653f997783a3714c4fe1) ---- - os/io.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/os/io.c b/os/io.c -index 9e483ae..9af1354 100644 ---- a/os/io.c -+++ b/os/io.c -@@ -398,6 +398,8 @@ ReadRequestFromClient(ClientPtr client) - needed = get_big_req_len(request, client); - } - client->req_len = needed; -+ if (needed > MAXINT >> 2) -+ return -(BadLength); - needed <<= 2; - } - if (gotnow < needed) { --- -2.49.0 - diff --git a/0003-xkb-Fix-buffer-overflow-in-XkbVModMaskText.patch b/0003-xkb-Fix-buffer-overflow-in-XkbVModMaskText.patch deleted file mode 100644 index 846c043..0000000 --- a/0003-xkb-Fix-buffer-overflow-in-XkbVModMaskText.patch +++ /dev/null @@ -1,63 +0,0 @@ -From bfbb53e0b93feb084c3c958e43eafb2adfd6527d Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 27 Nov 2024 14:41:45 +0100 -Subject: [PATCH xserver 03/13] xkb: Fix buffer overflow in XkbVModMaskText() - -The code in XkbVModMaskText() allocates a fixed sized buffer on the -stack and copies the virtual mod name. - -There's actually two issues in the code that can lead to a buffer -overflow. - -First, the bound check mixes pointers and integers using misplaced -parenthesis, defeating the bound check. - -But even though, if the check fails, the data is still copied, so the -stack overflow will occur regardless. - -Change the logic to skip the copy entirely if the bound check fails. - -CVE-2025-26595, ZDI-CAN-25545 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit 11fcda8753e994e15eb915d28cf487660ec8e722) - -Part-of: ---- - xkb/xkbtext.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c -index 7f377fdfc..96d2a683e 100644 ---- a/xkb/xkbtext.c -+++ b/xkb/xkbtext.c -@@ -174,14 +174,14 @@ XkbVModMaskText(XkbDescPtr xkb, - len = strlen(tmp) + 1 + (str == buf ? 0 : 1); - if (format == XkbCFile) - len += 4; -- if ((str - (buf + len)) <= VMOD_BUFFER_SIZE) { -- if (str != buf) { -- if (format == XkbCFile) -- *str++ = '|'; -- else -- *str++ = '+'; -- len--; -- } -+ if ((str - buf) + len > VMOD_BUFFER_SIZE) -+ continue; /* Skip */ -+ if (str != buf) { -+ if (format == XkbCFile) -+ *str++ = '|'; -+ else -+ *str++ = '+'; -+ len--; - } - if (format == XkbCFile) - sprintf(str, "%sMask", tmp); --- -2.48.1 - diff --git a/0003-xkb-Free-the-XKB-resource-when-freeing-XkbInterest.patch b/0003-xkb-Free-the-XKB-resource-when-freeing-XkbInterest.patch deleted file mode 100644 index 876c987..0000000 --- a/0003-xkb-Free-the-XKB-resource-when-freeing-XkbInterest.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 1abca0b9b5b019cda32aa92466a760660ebd952d Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 10 Sep 2025 15:58:57 +0200 -Subject: [PATCH xserver 3/4] xkb: Free the XKB resource when freeing - XkbInterest -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -XkbRemoveResourceClient() would free the XkbInterest data associated -with the device, but not the resource associated with it. - -As a result, when the client terminates, the resource delete function -gets called and accesses already freed memory: - - | Invalid read of size 8 - | at 0x5BC0C0: XkbRemoveResourceClient (xkbEvents.c:1047) - | by 0x5B3391: XkbClientGone (xkb.c:7094) - | by 0x4DF138: doFreeResource (resource.c:890) - | by 0x4DFB50: FreeClientResources (resource.c:1156) - | by 0x4A9A59: CloseDownClient (dispatch.c:3550) - | by 0x5E0A53: ClientReady (connection.c:601) - | by 0x5E4FEF: ospoll_wait (ospoll.c:657) - | by 0x5DC834: WaitForSomething (WaitFor.c:206) - | by 0x4A1BA5: Dispatch (dispatch.c:491) - | by 0x4B0070: dix_main (main.c:277) - | by 0x4285E7: main (stubmain.c:34) - | Address 0x1893e278 is 184 bytes inside a block of size 928 free'd - | at 0x4842E43: free (vg_replace_malloc.c:989) - | by 0x49C1A6: CloseDevice (devices.c:1067) - | by 0x49C522: CloseOneDevice (devices.c:1193) - | by 0x49C6E4: RemoveDevice (devices.c:1244) - | by 0x5873D4: remove_master (xichangehierarchy.c:348) - | by 0x587921: ProcXIChangeHierarchy (xichangehierarchy.c:504) - | by 0x579BF1: ProcIDispatch (extinit.c:390) - | by 0x4A1D85: Dispatch (dispatch.c:551) - | by 0x4B0070: dix_main (main.c:277) - | by 0x4285E7: main (stubmain.c:34) - | Block was alloc'd at - | at 0x48473F3: calloc (vg_replace_malloc.c:1675) - | by 0x49A118: AddInputDevice (devices.c:262) - | by 0x4A0E58: AllocDevicePair (devices.c:2846) - | by 0x5866EE: add_master (xichangehierarchy.c:153) - | by 0x5878C2: ProcXIChangeHierarchy (xichangehierarchy.c:493) - | by 0x579BF1: ProcIDispatch (extinit.c:390) - | by 0x4A1D85: Dispatch (dispatch.c:551) - | by 0x4B0070: dix_main (main.c:277) - | by 0x4285E7: main (stubmain.c:34) - -To avoid that issue, make sure to free the resources when freeing the -device XkbInterest data. - -CVE-2025-62230, ZDI-CAN-27545 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Michel Dänzer -(cherry picked from commit 10c94238bdad17c11707e0bdaaa3a9cd54c504be) - -Part-of: ---- - xkb/xkbEvents.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c -index f8f65d4a7..7c669c93e 100644 ---- a/xkb/xkbEvents.c -+++ b/xkb/xkbEvents.c -@@ -1055,6 +1055,7 @@ XkbRemoveResourceClient(DevicePtr inDev, XID id) - autoCtrls = interest->autoCtrls; - autoValues = interest->autoCtrlValues; - client = interest->client; -+ FreeResource(interest->resource, RT_XKBCLIENT); - free(interest); - found = TRUE; - } -@@ -1066,6 +1067,7 @@ XkbRemoveResourceClient(DevicePtr inDev, XID id) - autoCtrls = victim->autoCtrls; - autoValues = victim->autoCtrlValues; - client = victim->client; -+ FreeResource(victim->resource, RT_XKBCLIENT); - free(victim); - found = TRUE; - } --- -2.51.1 - diff --git a/0004-xfixes-Check-request-length-for-SetClientDisconnectM.patch b/0004-xfixes-Check-request-length-for-SetClientDisconnectM.patch deleted file mode 100644 index a47647e..0000000 --- a/0004-xfixes-Check-request-length-for-SetClientDisconnectM.patch +++ /dev/null @@ -1,52 +0,0 @@ -From ee2447ebdb1c4f499e809dfbb6eeed4af5f3bfdf Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 28 Apr 2025 10:05:36 +0200 -Subject: [PATCH 4/7] xfixes: Check request length for SetClientDisconnectMode - -The handler of XFixesSetClientDisconnectMode does not check the client -request length. - -A client could send a shorter request and read data from a former -request. - -Fix the issue by checking the request size matches. - -CVE-2025-49177 - -This issue was discovered by Nils Emmerich and -reported by Julian Suleder via ERNW Vulnerability Disclosure. - -Fixes: e167299f6 - xfixes: Add ClientDisconnectMode -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit ab02fb96b1c701c3bb47617d965522c34befa6af) - -Part-of: ---- - xfixes/disconnect.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/xfixes/disconnect.c b/xfixes/disconnect.c -index e412942..b3529af 100644 ---- a/xfixes/disconnect.c -+++ b/xfixes/disconnect.c -@@ -69,6 +69,7 @@ ProcXFixesSetClientDisconnectMode(ClientPtr client) - ClientDisconnectPtr pDisconnect = GetClientDisconnect(client); - - REQUEST(xXFixesSetClientDisconnectModeReq); -+ REQUEST_SIZE_MATCH(xXFixesSetClientDisconnectModeReq); - - pDisconnect->disconnect_mode = stuff->disconnect_mode; - -@@ -82,7 +83,7 @@ SProcXFixesSetClientDisconnectMode(ClientPtr client) - - swaps(&stuff->length); - -- REQUEST_AT_LEAST_SIZE(xXFixesSetClientDisconnectModeReq); -+ REQUEST_SIZE_MATCH(xXFixesSetClientDisconnectModeReq); - - swapl(&stuff->disconnect_mode); - --- -2.49.0 - diff --git a/0004-xkb-Fix-computation-of-XkbSizeKeySyms.patch b/0004-xkb-Fix-computation-of-XkbSizeKeySyms.patch deleted file mode 100644 index e3aff9e..0000000 --- a/0004-xkb-Fix-computation-of-XkbSizeKeySyms.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 60df8214679991795bf265c860a8b81aa2e174ce Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Thu, 28 Nov 2024 11:49:34 +0100 -Subject: [PATCH xserver 04/13] xkb: Fix computation of XkbSizeKeySyms - -The computation of the length in XkbSizeKeySyms() differs from what is -actually written in XkbWriteKeySyms(), leading to a heap overflow. - -Fix the calculation in XkbSizeKeySyms() to match what kbWriteKeySyms() -does. - -CVE-2025-26596, ZDI-CAN-25543 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit 80d69f01423fc065c950e1ff4e8ddf9f675df773) - -Part-of: ---- - xkb/xkb.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 8b63e34b5..ac154e200 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -1092,10 +1092,10 @@ XkbSizeKeySyms(XkbDescPtr xkb, xkbGetMapReply * rep) - len = rep->nKeySyms * SIZEOF(xkbSymMapWireDesc); - symMap = &xkb->map->key_sym_map[rep->firstKeySym]; - for (i = nSyms = 0; i < rep->nKeySyms; i++, symMap++) { -- if (symMap->offset != 0) { -- nSymsThisKey = XkbNumGroups(symMap->group_info) * symMap->width; -- nSyms += nSymsThisKey; -- } -+ nSymsThisKey = XkbNumGroups(symMap->group_info) * symMap->width; -+ if (nSymsThisKey == 0) -+ continue; -+ nSyms += nSymsThisKey; - } - len += nSyms * 4; - rep->totalSyms = nSyms; --- -2.48.1 - diff --git a/0004-xkb-Prevent-overflow-in-XkbSetCompatMap.patch b/0004-xkb-Prevent-overflow-in-XkbSetCompatMap.patch deleted file mode 100644 index 1fa65d0..0000000 --- a/0004-xkb-Prevent-overflow-in-XkbSetCompatMap.patch +++ /dev/null @@ -1,49 +0,0 @@ -From c7beaec76c556870e5566b84dce7099bf28f9502 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 10 Sep 2025 16:30:29 +0200 -Subject: [PATCH xserver 4/4] xkb: Prevent overflow in XkbSetCompatMap() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The XkbCompatMap structure stores its "num_si" and "size_si" fields -using an unsigned short. - -However, the function _XkbSetCompatMap() will store the sum of the -input data "firstSI" and "nSI" in both XkbCompatMap's "num_si" and -"size_si" without first checking if the sum overflows the maximum -unsigned short value, leading to a possible overflow. - -To avoid the issue, check whether the sum does not exceed the maximum -unsigned short value, or return a "BadValue" error otherwise. - -CVE-2025-62231, ZDI-CAN-27560 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Michel Dänzer -(cherry picked from commit 475d9f49acd0e55bc0b089ed77f732ad18585470) - -Part-of: ---- - xkb/xkb.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 6c102af0a..a77fe7ff0 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -2990,6 +2990,8 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev, - XkbSymInterpretPtr sym; - unsigned int skipped = 0; - -+ if ((unsigned) (req->firstSI + req->nSI) > USHRT_MAX) -+ return BadValue; - if ((unsigned) (req->firstSI + req->nSI) > compat->size_si) { - compat->num_si = compat->size_si = req->firstSI + req->nSI; - compat->sym_interpret = reallocarray(compat->sym_interpret, --- -2.51.1 - diff --git a/0005-os-Account-for-bytes-to-ignore-when-sharing-input-bu.patch b/0005-os-Account-for-bytes-to-ignore-when-sharing-input-bu.patch deleted file mode 100644 index 72c0e23..0000000 --- a/0005-os-Account-for-bytes-to-ignore-when-sharing-input-bu.patch +++ /dev/null @@ -1,47 +0,0 @@ -From d64a2f5e954a577383c8b9da0360428e7fe7e1d3 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 28 Apr 2025 10:46:03 +0200 -Subject: [PATCH 5/7] os: Account for bytes to ignore when sharing input buffer - -When reading requests from the clients, the input buffer might be shared -and used between different clients. - -If a given client sends a full request with non-zero bytes to ignore, -the bytes to ignore may still be non-zero even though the request is -full, in which case the buffer could be shared with another client who's -request will not be processed because of those bytes to ignore, leading -to a possible hang of the other client request. - -To avoid the issue, make sure we have zero bytes to ignore left in the -input request when sharing the input buffer with another client. - -CVE-2025-49178 - -This issue was discovered by Nils Emmerich and -reported by Julian Suleder via ERNW Vulnerability Disclosure. - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit d55c54cecb5e83eaa2d56bed5cc4461f9ba318c2) - -Part-of: ---- - os/io.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/os/io.c b/os/io.c -index 9af1354..0f5a466 100644 ---- a/os/io.c -+++ b/os/io.c -@@ -447,7 +447,7 @@ ReadRequestFromClient(ClientPtr client) - */ - - gotnow -= needed; -- if (!gotnow) -+ if (!gotnow && !oci->ignoreBytes) - AvailableInput = oc; - if (move_header) { - if (client->req_len < bytes_to_int32(sizeof(xBigReq) - sizeof(xReq))) { --- -2.49.0 - diff --git a/0005-xkb-Fix-buffer-overflow-in-XkbChangeTypesOfKey.patch b/0005-xkb-Fix-buffer-overflow-in-XkbChangeTypesOfKey.patch deleted file mode 100644 index 21ab89a..0000000 --- a/0005-xkb-Fix-buffer-overflow-in-XkbChangeTypesOfKey.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 39c7ed837bf1d6b5b45fd870bbdb15870c76b87f Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Thu, 28 Nov 2024 14:09:04 +0100 -Subject: [PATCH xserver 05/13] xkb: Fix buffer overflow in - XkbChangeTypesOfKey() - -If XkbChangeTypesOfKey() is called with nGroups == 0, it will resize the -key syms to 0 but leave the key actions unchanged. - -If later, the same function is called with a non-zero value for nGroups, -this will cause a buffer overflow because the key actions are of the wrong -size. - -To avoid the issue, make sure to resize both the key syms and key actions -when nGroups is 0. - -CVE-2025-26597, ZDI-CAN-25683 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit 0e4ed94952b255c04fe910f6a1d9c852878dcd64) - -Part-of: ---- - xkb/XKBMisc.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c -index 0a3b5cbc7..4e89b5bdf 100644 ---- a/xkb/XKBMisc.c -+++ b/xkb/XKBMisc.c -@@ -552,6 +552,7 @@ XkbChangeTypesOfKey(XkbDescPtr xkb, - i = XkbSetNumGroups(i, 0); - xkb->map->key_sym_map[key].group_info = i; - XkbResizeKeySyms(xkb, key, 0); -+ XkbResizeKeyActions(xkb, key, 0); - return Success; - } - --- -2.48.1 - diff --git a/0006-Xi-Fix-barrier-device-search.patch b/0006-Xi-Fix-barrier-device-search.patch deleted file mode 100644 index 3c5d321..0000000 --- a/0006-Xi-Fix-barrier-device-search.patch +++ /dev/null @@ -1,118 +0,0 @@ -From cc15c9fa406e2e6e23e203c0d18c915b623a55f9 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 16 Dec 2024 11:25:11 +0100 -Subject: [PATCH xserver 06/13] Xi: Fix barrier device search - -The function GetBarrierDevice() would search for the pointer device -based on its device id and return the matching value, or supposedly NULL -if no match was found. - -Unfortunately, as written, it would return the last element of the list -if no matching device id was found which can lead to out of bounds -memory access. - -Fix the search function to return NULL if not matching device is found, -and adjust the callers to handle the case where the device cannot be -found. - -CVE-2025-26598, ZDI-CAN-25740 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit bba9df1a9d57234c76c0b93f88dacb143d01bca2) - -Part-of: ---- - Xi/xibarriers.c | 27 +++++++++++++++++++++++---- - 1 file changed, 23 insertions(+), 4 deletions(-) - -diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c -index 1926762ad..cb336f22b 100644 ---- a/Xi/xibarriers.c -+++ b/Xi/xibarriers.c -@@ -129,14 +129,15 @@ static void FreePointerBarrierClient(struct PointerBarrierClient *c) - - static struct PointerBarrierDevice *GetBarrierDevice(struct PointerBarrierClient *c, int deviceid) - { -- struct PointerBarrierDevice *pbd = NULL; -+ struct PointerBarrierDevice *p, *pbd = NULL; - -- xorg_list_for_each_entry(pbd, &c->per_device, entry) { -- if (pbd->deviceid == deviceid) -+ xorg_list_for_each_entry(p, &c->per_device, entry) { -+ if (p->deviceid == deviceid) { -+ pbd = p; - break; -+ } - } - -- BUG_WARN(!pbd); - return pbd; - } - -@@ -337,6 +338,9 @@ barrier_find_nearest(BarrierScreenPtr cs, DeviceIntPtr dev, - double distance; - - pbd = GetBarrierDevice(c, dev->id); -+ if (!pbd) -+ continue; -+ - if (pbd->seen) - continue; - -@@ -445,6 +449,9 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, - nearest = &c->barrier; - - pbd = GetBarrierDevice(c, master->id); -+ if (!pbd) -+ continue; -+ - new_sequence = !pbd->hit; - - pbd->seen = TRUE; -@@ -485,6 +492,9 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, - int flags = 0; - - pbd = GetBarrierDevice(c, master->id); -+ if (!pbd) -+ continue; -+ - pbd->seen = FALSE; - if (!pbd->hit) - continue; -@@ -679,6 +689,9 @@ BarrierFreeBarrier(void *data, XID id) - continue; - - pbd = GetBarrierDevice(c, dev->id); -+ if (!pbd) -+ continue; -+ - if (!pbd->hit) - continue; - -@@ -738,6 +751,8 @@ static void remove_master_func(void *res, XID id, void *devid) - barrier = container_of(b, struct PointerBarrierClient, barrier); - - pbd = GetBarrierDevice(barrier, *deviceid); -+ if (!pbd) -+ return; - - if (pbd->hit) { - BarrierEvent ev = { -@@ -903,6 +918,10 @@ ProcXIBarrierReleasePointer(ClientPtr client) - barrier = container_of(b, struct PointerBarrierClient, barrier); - - pbd = GetBarrierDevice(barrier, dev->id); -+ if (!pbd) { -+ client->errorValue = dev->id; -+ return BadDevice; -+ } - - if (pbd->barrier_event_id == event_id) - pbd->release_event_id = event_id; --- -2.48.1 - diff --git a/0006-record-Check-for-overflow-in-RecordSanityCheckRegist.patch b/0006-record-Check-for-overflow-in-RecordSanityCheckRegist.patch deleted file mode 100644 index d318cb8..0000000 --- a/0006-record-Check-for-overflow-in-RecordSanityCheckRegist.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 45488ad0dc9564eff662c1515a4ce9468c69ec1a Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 28 Apr 2025 11:47:15 +0200 -Subject: [PATCH 6/7] record: Check for overflow in - RecordSanityCheckRegisterClients() - -The RecordSanityCheckRegisterClients() checks for the request length, -but does not check for integer overflow. - -A client might send a very large value for either the number of clients -or the number of protocol ranges that will cause an integer overflow in -the request length computation, defeating the check for request length. - -To avoid the issue, explicitly check the number of clients against the -limit of clients (which is much lower than an maximum integer value) and -the number of protocol ranges (multiplied by the record length) do not -exceed the maximum integer value. - -This way, we ensure that the final computation for the request length -will not overflow the maximum integer limit. - -CVE-2025-49179 - -This issue was discovered by Nils Emmerich and -reported by Julian Suleder via ERNW Vulnerability Disclosure. - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit 2bde9ca49a8fd9a1e6697d5e7ef837870d66f5d4) - -Part-of: ---- - record/record.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/record/record.c b/record/record.c -index ca9254c..d34fa10 100644 ---- a/record/record.c -+++ b/record/record.c -@@ -46,6 +46,7 @@ and Jim Haggerty of Metheus. - #include "swaprep.h" - #include "inputstr.h" - #include "scrnintstr.h" -+#include "opaque.h" - - #include - #include -@@ -1299,6 +1300,13 @@ RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client, - int i; - XID recordingClient; - -+ /* LimitClients is 2048 at max, way less that MAXINT */ -+ if (stuff->nClients > LimitClients) -+ return BadValue; -+ -+ if (stuff->nRanges > (MAXINT - 4 * stuff->nClients) / SIZEOF(xRecordRange)) -+ return BadValue; -+ - if (((client->req_len << 2) - SIZEOF(xRecordRegisterClientsReq)) != - 4 * stuff->nClients + SIZEOF(xRecordRange) * stuff->nRanges) - return BadLength; --- -2.49.0 - diff --git a/0007-composite-Handle-failure-to-redirect-in-compRedirect.patch b/0007-composite-Handle-failure-to-redirect-in-compRedirect.patch deleted file mode 100644 index 64db417..0000000 --- a/0007-composite-Handle-failure-to-redirect-in-compRedirect.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 40efa6359cd184d6d1413f02e4418c9930c73f88 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Tue, 17 Dec 2024 15:19:45 +0100 -Subject: [PATCH xserver 07/13] composite: Handle failure to redirect in - compRedirectWindow() - -The function compCheckRedirect() may fail if it cannot allocate the -backing pixmap. - -In that case, compRedirectWindow() will return a BadAlloc error. - -However that failure code path will shortcut the validation of the -window tree marked just before, which leaves the validate data partly -initialized. - -That causes a use of uninitialized pointer later. - -The fix is to not shortcut the call to compHandleMarkedWindows() even in -the case of compCheckRedirect() returning an error. - -CVE-2025-26599, ZDI-CAN-25851 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Acked-by: Peter Hutterer -(cherry picked from commit c1ff84bef2569b4ba4be59323cf575d1798ba9be) - -Part-of: ---- - composite/compalloc.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/composite/compalloc.c b/composite/compalloc.c -index acd215002..83894aa1f 100644 ---- a/composite/compalloc.c -+++ b/composite/compalloc.c -@@ -140,6 +140,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update) - CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen); - WindowPtr pLayerWin; - Bool anyMarked = FALSE; -+ int status = Success; - - if (pWin == cs->pOverlayWin) { - return Success; -@@ -218,13 +219,13 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update) - - if (!compCheckRedirect(pWin)) { - FreeResource(ccw->id, RT_NONE); -- return BadAlloc; -+ status = BadAlloc; - } - - if (anyMarked) - compHandleMarkedWindows(pWin, pLayerWin); - -- return Success; -+ return status; - } - - void --- -2.48.1 - diff --git a/0007-randr-Check-for-overflow-in-RRChangeProviderProperty.patch b/0007-randr-Check-for-overflow-in-RRChangeProviderProperty.patch deleted file mode 100644 index 6defd95..0000000 --- a/0007-randr-Check-for-overflow-in-RRChangeProviderProperty.patch +++ /dev/null @@ -1,42 +0,0 @@ -From d19d7a4608ffb8ad5631db053a81b998c03d8cd3 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Tue, 20 May 2025 15:18:19 +0200 -Subject: [PATCH 7/7] randr: Check for overflow in RRChangeProviderProperty() - -A client might send a request causing an integer overflow when computing -the total size to allocate in RRChangeProviderProperty(). - -To avoid the issue, check that total length in bytes won't exceed the -maximum integer value. - -CVE-2025-49180 - -This issue was discovered by Nils Emmerich and -reported by Julian Suleder via ERNW Vulnerability Disclosure. - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit 3c3a4b767b16174d3213055947ea7f4f88e10ec6) - -Part-of: ---- - randr/rrproviderproperty.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c -index 7f22c7e..3deb0cb 100644 ---- a/randr/rrproviderproperty.c -+++ b/randr/rrproviderproperty.c -@@ -179,7 +179,8 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, - - if (mode == PropModeReplace || len > 0) { - void *new_data = NULL, *old_data = NULL; -- -+ if (total_len > MAXINT / size_in_bytes) -+ return BadValue; - total_size = total_len * size_in_bytes; - new_value.data = (void *) malloc(total_size); - if (!new_value.data && total_size) { --- -2.49.0 - diff --git a/0008-composite-initialize-border-clip-even-when-pixmap-al.patch b/0008-composite-initialize-border-clip-even-when-pixmap-al.patch deleted file mode 100644 index bb122be..0000000 --- a/0008-composite-initialize-border-clip-even-when-pixmap-al.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 318085a6f50b854430a87f1af225f1d37332ad17 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 13 Jan 2025 16:09:43 +0100 -Subject: [PATCH xserver 08/13] composite: initialize border clip even when - pixmap alloc fails - -If it fails to allocate the pixmap, the function compAllocPixmap() would -return early and leave the borderClip region uninitialized, which may -lead to the use of uninitialized value as reported by valgrind: - - Conditional jump or move depends on uninitialised value(s) - at 0x4F9B33: compClipNotify (compwindow.c:317) - by 0x484FC9: miComputeClips (mivaltree.c:476) - by 0x48559A: miValidateTree (mivaltree.c:679) - by 0x4F0685: MapWindow (window.c:2693) - by 0x4A344A: ProcMapWindow (dispatch.c:922) - by 0x4A25B5: Dispatch (dispatch.c:560) - by 0x4B082A: dix_main (main.c:282) - by 0x429233: main (stubmain.c:34) - Uninitialised value was created by a heap allocation - at 0x4841866: malloc (vg_replace_malloc.c:446) - by 0x4F47BC: compRedirectWindow (compalloc.c:171) - by 0x4FA8AD: compCreateWindow (compwindow.c:592) - by 0x4EBB89: CreateWindow (window.c:925) - by 0x4A2E6E: ProcCreateWindow (dispatch.c:768) - by 0x4A25B5: Dispatch (dispatch.c:560) - by 0x4B082A: dix_main (main.c:282) - by 0x429233: main (stubmain.c:34) - - Conditional jump or move depends on uninitialised value(s) - at 0x48EEDBC: pixman_region_translate (pixman-region.c:2233) - by 0x4F9255: RegionTranslate (regionstr.h:312) - by 0x4F9B7E: compClipNotify (compwindow.c:319) - by 0x484FC9: miComputeClips (mivaltree.c:476) - by 0x48559A: miValidateTree (mivaltree.c:679) - by 0x4F0685: MapWindow (window.c:2693) - by 0x4A344A: ProcMapWindow (dispatch.c:922) - by 0x4A25B5: Dispatch (dispatch.c:560) - by 0x4B082A: dix_main (main.c:282) - by 0x429233: main (stubmain.c:34) - Uninitialised value was created by a heap allocation - at 0x4841866: malloc (vg_replace_malloc.c:446) - by 0x4F47BC: compRedirectWindow (compalloc.c:171) - by 0x4FA8AD: compCreateWindow (compwindow.c:592) - by 0x4EBB89: CreateWindow (window.c:925) - by 0x4A2E6E: ProcCreateWindow (dispatch.c:768) - by 0x4A25B5: Dispatch (dispatch.c:560) - by 0x4B082A: dix_main (main.c:282) - by 0x429233: main (stubmain.c:34) - - Conditional jump or move depends on uninitialised value(s) - at 0x48EEE33: UnknownInlinedFun (pixman-region.c:2241) - by 0x48EEE33: pixman_region_translate (pixman-region.c:2225) - by 0x4F9255: RegionTranslate (regionstr.h:312) - by 0x4F9B7E: compClipNotify (compwindow.c:319) - by 0x484FC9: miComputeClips (mivaltree.c:476) - by 0x48559A: miValidateTree (mivaltree.c:679) - by 0x4F0685: MapWindow (window.c:2693) - by 0x4A344A: ProcMapWindow (dispatch.c:922) - by 0x4A25B5: Dispatch (dispatch.c:560) - by 0x4B082A: dix_main (main.c:282) - by 0x429233: main (stubmain.c:34) - Uninitialised value was created by a heap allocation - at 0x4841866: malloc (vg_replace_malloc.c:446) - by 0x4F47BC: compRedirectWindow (compalloc.c:171) - by 0x4FA8AD: compCreateWindow (compwindow.c:592) - by 0x4EBB89: CreateWindow (window.c:925) - by 0x4A2E6E: ProcCreateWindow (dispatch.c:768) - by 0x4A25B5: Dispatch (dispatch.c:560) - by 0x4B082A: dix_main (main.c:282) - by 0x429233: main (stubmain.c:34) - -Fix compAllocPixmap() to initialize the border clip even if the creation -of the backing pixmap has failed, to avoid depending later on -uninitialized border clip values. - -Related to CVE-2025-26599, ZDI-CAN-25851 - -Signed-off-by: Olivier Fourdan -Acked-by: Peter Hutterer -(cherry picked from commit b07192a8bedb90b039dc0f70ae69daf047ff9598) - -Part-of: ---- - composite/compalloc.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/composite/compalloc.c b/composite/compalloc.c -index 83894aa1f..ba3168480 100644 ---- a/composite/compalloc.c -+++ b/composite/compalloc.c -@@ -606,9 +606,12 @@ compAllocPixmap(WindowPtr pWin) - int h = pWin->drawable.height + (bw << 1); - PixmapPtr pPixmap = compNewPixmap(pWin, x, y, w, h); - CompWindowPtr cw = GetCompWindow(pWin); -+ Bool status; - -- if (!pPixmap) -- return FALSE; -+ if (!pPixmap) { -+ status = FALSE; -+ goto out; -+ } - if (cw->update == CompositeRedirectAutomatic) - pWin->redirectDraw = RedirectDrawAutomatic; - else -@@ -622,14 +625,16 @@ compAllocPixmap(WindowPtr pWin) - DamageRegister(&pWin->drawable, cw->damage); - cw->damageRegistered = TRUE; - } -+ status = TRUE; - -+out: - /* Make sure our borderClip is up to date */ - RegionUninit(&cw->borderClip); - RegionCopy(&cw->borderClip, &pWin->borderClip); - cw->borderClipX = pWin->drawable.x; - cw->borderClipY = pWin->drawable.y; - -- return TRUE; -+ return status; - } - - void --- -2.48.1 - diff --git a/0009-dix-Dequeue-pending-events-on-frozen-device-on-remov.patch b/0009-dix-Dequeue-pending-events-on-frozen-device-on-remov.patch deleted file mode 100644 index e33195d..0000000 --- a/0009-dix-Dequeue-pending-events-on-frozen-device-on-remov.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 842f4abde4dfdf396437b6eabf331e642c5d4b9c Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 16 Dec 2024 16:18:04 +0100 -Subject: [PATCH xserver 09/13] dix: Dequeue pending events on frozen device on - removal - -When a device is removed while still frozen, the events queued for that -device remain while the device itself is freed. - -As a result, replaying the events will cause a use after free. - -To avoid the issue, make sure to dequeue and free any pending events on -a frozen device when removed. - -CVE-2025-26600, ZDI-CAN-25871 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit 6e0f332ba4c8b8c9a9945dc9d7989bfe06f80e14) - -Part-of: ---- - dix/devices.c | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/dix/devices.c b/dix/devices.c -index 6e27e3e2e..02b0ea1cc 100644 ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -981,6 +981,23 @@ FreeAllDeviceClasses(ClassesPtr classes) - - } - -+static void -+FreePendingFrozenDeviceEvents(DeviceIntPtr dev) -+{ -+ QdEventPtr qe, tmp; -+ -+ if (!dev->deviceGrab.sync.frozen) -+ return; -+ -+ /* Dequeue any frozen pending events */ -+ xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) { -+ if (qe->device == dev) { -+ xorg_list_del(&qe->next); -+ free(qe); -+ } -+ } -+} -+ - /** - * Close down a device and free all resources. - * Once closed down, the driver will probably not expect you that you'll ever -@@ -1045,6 +1062,7 @@ CloseDevice(DeviceIntPtr dev) - valuator_mask_free(&dev->last.touches[j].valuators); - free(dev->last.touches); - dev->config_info = NULL; -+ FreePendingFrozenDeviceEvents(dev); - dixFreePrivates(dev->devPrivates, PRIVATE_DEVICE); - free(dev); - } --- -2.48.1 - diff --git a/0010-sync-Do-not-let-sync-objects-uninitialized.patch b/0010-sync-Do-not-let-sync-objects-uninitialized.patch deleted file mode 100644 index 04e618f..0000000 --- a/0010-sync-Do-not-let-sync-objects-uninitialized.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 1932abe3d0db719b0676afdad14f1716ef9387ee Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 20 Jan 2025 16:52:01 +0100 -Subject: [PATCH xserver 10/13] sync: Do not let sync objects uninitialized - -When changing an alarm, the change mask values are evaluated one after -the other, changing the trigger values as requested and eventually, -SyncInitTrigger() is called. - -SyncInitTrigger() will evaluate the XSyncCACounter first and may free -the existing sync object. - -Other changes are then evaluated and may trigger an error and an early -return, not adding the new sync object. - -This can be used to cause a use after free when the alarm eventually -triggers. - -To avoid the issue, delete the existing sync object as late as possible -only once we are sure that no further error will cause an early exit. - -CVE-2025-26601, ZDI-CAN-25870 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit 16a1242d0ffc7f45ed3c595ee7564b5c04287e0b) - -Part-of: ---- - Xext/sync.c | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -diff --git a/Xext/sync.c b/Xext/sync.c -index 8da5bf616..1c186095d 100644 ---- a/Xext/sync.c -+++ b/Xext/sync.c -@@ -330,11 +330,6 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject, - client->errorValue = syncObject; - return rc; - } -- if (pSync != pTrigger->pSync) { /* new counter for trigger */ -- SyncDeleteTriggerFromSyncObject(pTrigger); -- pTrigger->pSync = pSync; -- newSyncObject = TRUE; -- } - } - - /* if system counter, ask it what the current value is */ -@@ -402,6 +397,14 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject, - } - } - -+ if (changes & XSyncCACounter) { -+ if (pSync != pTrigger->pSync) { /* new counter for trigger */ -+ SyncDeleteTriggerFromSyncObject(pTrigger); -+ pTrigger->pSync = pSync; -+ newSyncObject = TRUE; -+ } -+ } -+ - /* we wait until we're sure there are no errors before registering - * a new counter on a trigger - */ --- -2.48.1 - diff --git a/0011-sync-Check-values-before-applying-changes.patch b/0011-sync-Check-values-before-applying-changes.patch deleted file mode 100644 index 0cc96ad..0000000 --- a/0011-sync-Check-values-before-applying-changes.patch +++ /dev/null @@ -1,83 +0,0 @@ -From fb6df2a68c31bd025182483b0692e36f3b9f51a3 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 20 Jan 2025 16:54:30 +0100 -Subject: [PATCH xserver 11/13] sync: Check values before applying changes - -In SyncInitTrigger(), we would set the CheckTrigger function before -validating the counter value. - -As a result, if the counter value overflowed, we would leave the -function SyncInitTrigger() with the CheckTrigger applied but without -updating the trigger object. - -To avoid that issue, move the portion of code checking for the trigger -check value before updating the CheckTrigger function. - -Related to CVE-2025-26601, ZDI-CAN-25870 - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit f52cea2f93a0c891494eb3334894442a92368030) - -Part-of: ---- - Xext/sync.c | 36 ++++++++++++++++++------------------ - 1 file changed, 18 insertions(+), 18 deletions(-) - -diff --git a/Xext/sync.c b/Xext/sync.c -index 1c186095d..9fc82443b 100644 ---- a/Xext/sync.c -+++ b/Xext/sync.c -@@ -351,6 +351,24 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject, - } - } - -+ if (changes & (XSyncCAValueType | XSyncCAValue)) { -+ if (pTrigger->value_type == XSyncAbsolute) -+ pTrigger->test_value = pTrigger->wait_value; -+ else { /* relative */ -+ Bool overflow; -+ -+ if (pCounter == NULL) -+ return BadMatch; -+ -+ overflow = checked_int64_add(&pTrigger->test_value, -+ pCounter->value, pTrigger->wait_value); -+ if (overflow) { -+ client->errorValue = pTrigger->wait_value >> 32; -+ return BadValue; -+ } -+ } -+ } -+ - if (changes & XSyncCATestType) { - - if (pSync && SYNC_FENCE == pSync->type) { -@@ -379,24 +397,6 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject, - } - } - -- if (changes & (XSyncCAValueType | XSyncCAValue)) { -- if (pTrigger->value_type == XSyncAbsolute) -- pTrigger->test_value = pTrigger->wait_value; -- else { /* relative */ -- Bool overflow; -- -- if (pCounter == NULL) -- return BadMatch; -- -- overflow = checked_int64_add(&pTrigger->test_value, -- pCounter->value, pTrigger->wait_value); -- if (overflow) { -- client->errorValue = pTrigger->wait_value >> 32; -- return BadValue; -- } -- } -- } -- - if (changes & XSyncCACounter) { - if (pSync != pTrigger->pSync) { /* new counter for trigger */ - SyncDeleteTriggerFromSyncObject(pTrigger); --- -2.48.1 - diff --git a/0012-sync-Do-not-fail-SyncAddTriggerToSyncObject.patch b/0012-sync-Do-not-fail-SyncAddTriggerToSyncObject.patch deleted file mode 100644 index d5766b3..0000000 --- a/0012-sync-Do-not-fail-SyncAddTriggerToSyncObject.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 6f567221a61663b5ec959817cc11ecb1f15ce205 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 20 Jan 2025 17:06:07 +0100 -Subject: [PATCH xserver 12/13] sync: Do not fail SyncAddTriggerToSyncObject() - -We do not want to return a failure at the very last step in -SyncInitTrigger() after having all changes applied. - -SyncAddTriggerToSyncObject() must not fail on memory allocation, if the -allocation of the SyncTriggerList fails, trigger a FatalError() instead. - -Related to CVE-2025-26601, ZDI-CAN-25870 - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit 8cbc90c8817306af75a60f494ec9dbb1061e50db) - -Part-of: ---- - Xext/sync.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/Xext/sync.c b/Xext/sync.c -index 9fc82443b..4fd2baf55 100644 ---- a/Xext/sync.c -+++ b/Xext/sync.c -@@ -200,8 +200,8 @@ SyncAddTriggerToSyncObject(SyncTrigger * pTrigger) - return Success; - } - -- if (!(pCur = malloc(sizeof(SyncTriggerList)))) -- return BadAlloc; -+ /* Failure is not an option, it's succeed or burst! */ -+ pCur = XNFalloc(sizeof(SyncTriggerList)); - - pCur->pTrigger = pTrigger; - pCur->next = pTrigger->pSync->pTriglist; -@@ -409,8 +409,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject, - * a new counter on a trigger - */ - if (newSyncObject) { -- if ((rc = SyncAddTriggerToSyncObject(pTrigger)) != Success) -- return rc; -+ SyncAddTriggerToSyncObject(pTrigger); - } - else if (pCounter && IsSystemCounter(pCounter)) { - SyncComputeBracketValues(pCounter); --- -2.48.1 - diff --git a/0013-sync-Apply-changes-last-in-SyncChangeAlarmAttributes.patch b/0013-sync-Apply-changes-last-in-SyncChangeAlarmAttributes.patch deleted file mode 100644 index 2fde3f4..0000000 --- a/0013-sync-Apply-changes-last-in-SyncChangeAlarmAttributes.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 9dbe93ebeed0f175f4c5faf175aa263b524d4034 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 20 Jan 2025 17:10:31 +0100 -Subject: [PATCH xserver 13/13] sync: Apply changes last in - SyncChangeAlarmAttributes() - -SyncChangeAlarmAttributes() would apply the various changes while -checking for errors. - -If one of the changes triggers an error, the changes for the trigger, -counter or delta value would remain, possibly leading to inconsistent -changes. - -Postpone the actual changes until we're sure nothing else can go wrong. - -Related to CVE-2025-26601, ZDI-CAN-25870 - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit c285798984c6bb99e454a33772cde23d394d3dcd) - -Part-of: ---- - Xext/sync.c | 42 +++++++++++++++++++++++++++--------------- - 1 file changed, 27 insertions(+), 15 deletions(-) - -diff --git a/Xext/sync.c b/Xext/sync.c -index 4fd2baf55..30ce68ca2 100644 ---- a/Xext/sync.c -+++ b/Xext/sync.c -@@ -800,8 +800,14 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask, - int status; - XSyncCounter counter; - Mask origmask = mask; -+ SyncTrigger trigger; -+ Bool select_events_changed = FALSE; -+ Bool select_events_value = FALSE; -+ int64_t delta; - -- counter = pAlarm->trigger.pSync ? pAlarm->trigger.pSync->id : None; -+ trigger = pAlarm->trigger; -+ delta = pAlarm->delta; -+ counter = trigger.pSync ? trigger.pSync->id : None; - - while (mask) { - int index2 = lowbit(mask); -@@ -817,24 +823,24 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask, - case XSyncCAValueType: - mask &= ~XSyncCAValueType; - /* sanity check in SyncInitTrigger */ -- pAlarm->trigger.value_type = *values++; -+ trigger.value_type = *values++; - break; - - case XSyncCAValue: - mask &= ~XSyncCAValue; -- pAlarm->trigger.wait_value = ((int64_t)values[0] << 32) | values[1]; -+ trigger.wait_value = ((int64_t)values[0] << 32) | values[1]; - values += 2; - break; - - case XSyncCATestType: - mask &= ~XSyncCATestType; - /* sanity check in SyncInitTrigger */ -- pAlarm->trigger.test_type = *values++; -+ trigger.test_type = *values++; - break; - - case XSyncCADelta: - mask &= ~XSyncCADelta; -- pAlarm->delta = ((int64_t)values[0] << 32) | values[1]; -+ delta = ((int64_t)values[0] << 32) | values[1]; - values += 2; - break; - -@@ -844,10 +850,8 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask, - client->errorValue = *values; - return BadValue; - } -- status = SyncEventSelectForAlarm(pAlarm, client, -- (Bool) (*values++)); -- if (status != Success) -- return status; -+ select_events_value = (Bool) (*values++); -+ select_events_changed = TRUE; - break; - - default: -@@ -856,25 +860,33 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask, - } - } - -+ if (select_events_changed) { -+ status = SyncEventSelectForAlarm(pAlarm, client, select_events_value); -+ if (status != Success) -+ return status; -+ } -+ - /* "If the test-type is PositiveComparison or PositiveTransition - * and delta is less than zero, or if the test-type is - * NegativeComparison or NegativeTransition and delta is - * greater than zero, a Match error is generated." - */ - if (origmask & (XSyncCADelta | XSyncCATestType)) { -- if ((((pAlarm->trigger.test_type == XSyncPositiveComparison) || -- (pAlarm->trigger.test_type == XSyncPositiveTransition)) -- && pAlarm->delta < 0) -+ if ((((trigger.test_type == XSyncPositiveComparison) || -+ (trigger.test_type == XSyncPositiveTransition)) -+ && delta < 0) - || -- (((pAlarm->trigger.test_type == XSyncNegativeComparison) || -- (pAlarm->trigger.test_type == XSyncNegativeTransition)) -- && pAlarm->delta > 0) -+ (((trigger.test_type == XSyncNegativeComparison) || -+ (trigger.test_type == XSyncNegativeTransition)) -+ && delta > 0) - ) { - return BadMatch; - } - } - - /* postpone this until now, when we're sure nothing else can go wrong */ -+ pAlarm->delta = delta; -+ pAlarm->trigger = trigger; - if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter, RTCounter, - origmask & XSyncCAAllTrigger)) != Success) - return status; --- -2.48.1 - diff --git a/sources b/sources index 34e7bfa..469b085 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (xwayland-24.1.5.tar.xz) = 4c821e62013c2c79edff364c3c5e34c58f9b0e0c411baba23d9ebe3fe1daf8bbb99e56b6041c5cba66a219d9f80c469a5ee1238cef728eda197f19e7bba1e74a +SHA512 (xwayland-24.1.9.tar.xz) = 7438a572651dc77c1fd749879abccdc9a245c7b75143668d5561a8e99d41063f042a8eb3f9b931a2a12be1fc3cb9d197eee6794d0702a19e56c20f55acb35a26 diff --git a/xorg-x11-server-Xwayland.spec b/xorg-x11-server-Xwayland.spec index bb647c0..b50b3e8 100644 --- a/xorg-x11-server-Xwayland.spec +++ b/xorg-x11-server-Xwayland.spec @@ -8,8 +8,8 @@ Summary: Xwayland Name: xorg-x11-server-Xwayland -Version: 24.1.5 -Release: 5%{?gitdate:.%{gitdate}git%{shortcommit}}%{?dist} +Version: 24.1.9 +Release: 1%{?gitdate:.%{gitdate}git%{shortcommit}}%{?dist} URL: http://www.x.org %if 0%{?gitdate} @@ -18,51 +18,6 @@ Source0: https://gitlab.freedesktop.org/xorg/%{pkgname}/-/archive/%{commit}/%{ Source0: https://www.x.org/pub/individual/xserver/%{pkgname}-%{version}.tar.xz %endif -# Fix a regression with gamescope -# https://gitlab.freedesktop.org/xorg/xserver/-/issues/1790 -Patch: 0001-Revert-xwayland-Don-t-run-key-behaviors-and-actions.patch -# CVE-2025-26594: Use-after-free of the root cursor -Patch: 0001-Cursor-Refuse-to-free-the-root-cursor.patch -Patch: 0002-dix-keep-a-ref-to-the-rootCursor.patch -# CVE-2025-26595: Buffer overflow in XkbVModMaskText() -Patch: 0003-xkb-Fix-buffer-overflow-in-XkbVModMaskText.patch -# CVE-2025-26596: Heap overflow in XkbWriteKeySyms() -Patch: 0004-xkb-Fix-computation-of-XkbSizeKeySyms.patch -# CVE-2025-26597: Buffer overflow in XkbChangeTypesOfKey() -Patch: 0005-xkb-Fix-buffer-overflow-in-XkbChangeTypesOfKey.patch -# CVE-2025-26598: Out-of-bounds write in CreatePointerBarrierClient() -Patch: 0006-Xi-Fix-barrier-device-search.patch -# CVE-2025-26599: Use of uninitialized pointer in compRedirectWindow() -Patch: 0007-composite-Handle-failure-to-redirect-in-compRedirect.patch -Patch: 0008-composite-initialize-border-clip-even-when-pixmap-al.patch -# CVE-2025-26600: Use-after-free in PlayReleasedEvents() -Patch: 0009-dix-Dequeue-pending-events-on-frozen-device-on-remov.patch -# CVE-2025-26601: Use-after-free in SyncInitTrigger() -Patch: 0010-sync-Do-not-let-sync-objects-uninitialized.patch -Patch: 0011-sync-Check-values-before-applying-changes.patch -Patch: 0012-sync-Do-not-fail-SyncAddTriggerToSyncObject.patch -Patch: 0013-sync-Apply-changes-last-in-SyncChangeAlarmAttributes.patch -# CVE-2025-49175: Out-of-bounds access in X Rendering extension -Patch: 0001-render-Avoid-0-or-less-animated-cursors.patch -# CVE-2025-49176: Integer overflow in Big Requests Extension -Patch: 0002-os-Do-not-overflow-the-integer-size-with-BigRequest.patch -Patch: 0003-os-Check-for-integer-overflow-on-BigRequest-length.patch -# CVE-2025-49177: Data leak in XFIXES Extension 6 -Patch: 0004-xfixes-Check-request-length-for-SetClientDisconnectM.patch -# CVE-2025-49178: Unprocessed client request via bytes to ignore -Patch: 0005-os-Account-for-bytes-to-ignore-when-sharing-input-bu.patch -# CVE-2025-49179: Integer overflow in X Record extension -Patch: 0006-record-Check-for-overflow-in-RecordSanityCheckRegist.patch -# CVE-2025-49180: Integer overflow in RandR extension -Patch: 0007-randr-Check-for-overflow-in-RRChangeProviderProperty.patch -# CVE-2025-62229: Use-after-free in XPresentNotify structures creation -Patch: 0001-present-Fix-use-after-free-in-present_create_notifie.patch -# CVE-2025-62230: Use-after-free in Xkb client resource removal -Patch: 0002-xkb-Make-the-RT_XKBCLIENT-resource-private.patch -Patch: 0003-xkb-Free-the-XKB-resource-when-freeing-XkbInterest.patch -# CVE-2025-62231: Value overflow in Xkb extension XkbSetCompatMap() -Patch: 0004-xkb-Prevent-overflow-in-XkbSetCompatMap.patch - License: MIT Requires: xkeyboard-config @@ -178,6 +133,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_libdir}/pkgconfig/xwayland.pc %changelog +* Fri Nov 7 2025 Olivier Fourdan - 24.1.9-1 +- Rebase to Xwayland 24.1.9 (RHEL-120264) + * Thu Oct 30 2025 Olivier Fourdan - 24.1.5-5 - CVE fix for: CVE-2025-62229 (RHEL-119966), CVE-2025-62230 (RHEL-120012), CVE-2025-62231 (RHEL-125005)