diff --git a/.gitignore b/.gitignore index 9ae5e45..e475d81 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/xwayland-21.1.3.tar.xz +xwayland-24.1.5.tar.xz diff --git a/.xorg-x11-server-Xwayland.metadata b/.xorg-x11-server-Xwayland.metadata deleted file mode 100644 index cebe01a..0000000 --- a/.xorg-x11-server-Xwayland.metadata +++ /dev/null @@ -1 +0,0 @@ -ae980a7deeb7cad9f3cd253f3b1ddca5bb26aafa SOURCES/xwayland-21.1.3.tar.xz diff --git a/0001-Cursor-Refuse-to-free-the-root-cursor.patch b/0001-Cursor-Refuse-to-free-the-root-cursor.patch new file mode 100644 index 0000000..916a743 --- /dev/null +++ b/0001-Cursor-Refuse-to-free-the-root-cursor.patch @@ -0,0 +1,55 @@ +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 new file mode 100644 index 0000000..e06d8e4 --- /dev/null +++ b/0001-Revert-xwayland-Don-t-run-key-behaviors-and-actions.patch @@ -0,0 +1,106 @@ +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/0002-dix-keep-a-ref-to-the-rootCursor.patch b/0002-dix-keep-a-ref-to-the-rootCursor.patch new file mode 100644 index 0000000..d56a2a8 --- /dev/null +++ b/0002-dix-keep-a-ref-to-the-rootCursor.patch @@ -0,0 +1,49 @@ +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/0003-xkb-Fix-buffer-overflow-in-XkbVModMaskText.patch b/0003-xkb-Fix-buffer-overflow-in-XkbVModMaskText.patch new file mode 100644 index 0000000..846c043 --- /dev/null +++ b/0003-xkb-Fix-buffer-overflow-in-XkbVModMaskText.patch @@ -0,0 +1,63 @@ +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/0004-xkb-Fix-computation-of-XkbSizeKeySyms.patch b/0004-xkb-Fix-computation-of-XkbSizeKeySyms.patch new file mode 100644 index 0000000..e3aff9e --- /dev/null +++ b/0004-xkb-Fix-computation-of-XkbSizeKeySyms.patch @@ -0,0 +1,47 @@ +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/0005-xkb-Fix-buffer-overflow-in-XkbChangeTypesOfKey.patch b/0005-xkb-Fix-buffer-overflow-in-XkbChangeTypesOfKey.patch new file mode 100644 index 0000000..21ab89a --- /dev/null +++ b/0005-xkb-Fix-buffer-overflow-in-XkbChangeTypesOfKey.patch @@ -0,0 +1,45 @@ +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 new file mode 100644 index 0000000..3c5d321 --- /dev/null +++ b/0006-Xi-Fix-barrier-device-search.patch @@ -0,0 +1,118 @@ +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/0007-composite-Handle-failure-to-redirect-in-compRedirect.patch b/0007-composite-Handle-failure-to-redirect-in-compRedirect.patch new file mode 100644 index 0000000..64db417 --- /dev/null +++ b/0007-composite-Handle-failure-to-redirect-in-compRedirect.patch @@ -0,0 +1,65 @@ +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/0008-composite-initialize-border-clip-even-when-pixmap-al.patch b/0008-composite-initialize-border-clip-even-when-pixmap-al.patch new file mode 100644 index 0000000..bb122be --- /dev/null +++ b/0008-composite-initialize-border-clip-even-when-pixmap-al.patch @@ -0,0 +1,127 @@ +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 new file mode 100644 index 0000000..e33195d --- /dev/null +++ b/0009-dix-Dequeue-pending-events-on-frozen-device-on-remov.patch @@ -0,0 +1,67 @@ +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 new file mode 100644 index 0000000..04e618f --- /dev/null +++ b/0010-sync-Do-not-let-sync-objects-uninitialized.patch @@ -0,0 +1,69 @@ +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 new file mode 100644 index 0000000..0cc96ad --- /dev/null +++ b/0011-sync-Check-values-before-applying-changes.patch @@ -0,0 +1,83 @@ +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 new file mode 100644 index 0000000..d5766b3 --- /dev/null +++ b/0012-sync-Do-not-fail-SyncAddTriggerToSyncObject.patch @@ -0,0 +1,50 @@ +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 new file mode 100644 index 0000000..2fde3f4 --- /dev/null +++ b/0013-sync-Apply-changes-last-in-SyncChangeAlarmAttributes.patch @@ -0,0 +1,131 @@ +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/0001-Xi-allocate-enough-XkbActions-for-our-buttons.patch b/SOURCES/0001-Xi-allocate-enough-XkbActions-for-our-buttons.patch deleted file mode 100644 index 111f095..0000000 --- a/SOURCES/0001-Xi-allocate-enough-XkbActions-for-our-buttons.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 19e9f199950aaa4b9b7696936d1b067475da999c Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 28 Nov 2023 15:19:04 +1000 -Subject: [PATCH xserver] Xi: allocate enough XkbActions for our buttons - -button->xkb_acts is supposed to be an array sufficiently large for all -our buttons, not just a single XkbActions struct. Allocating -insufficient memory here means when we memcpy() later in -XkbSetDeviceInfo we write into memory that wasn't ours to begin with, -leading to the usual security ooopsiedaisies. - -CVE-2023-6377, ZDI-CAN-22412, ZDI-CAN-22413 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -(cherry picked from commit 0c1a93d319558fe3ab2d94f51d174b4f93810afd) ---- - Xi/exevents.c | 12 ++++++------ - dix/devices.c | 10 ++++++++++ - 2 files changed, 16 insertions(+), 6 deletions(-) - -diff --git a/Xi/exevents.c b/Xi/exevents.c -index dcd4efb3b..54ea11a93 100644 ---- a/Xi/exevents.c -+++ b/Xi/exevents.c -@@ -611,13 +611,13 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) - } - - if (from->button->xkb_acts) { -- if (!to->button->xkb_acts) { -- to->button->xkb_acts = calloc(1, sizeof(XkbAction)); -- if (!to->button->xkb_acts) -- FatalError("[Xi] not enough memory for xkb_acts.\n"); -- } -+ size_t maxbuttons = max(to->button->numButtons, from->button->numButtons); -+ to->button->xkb_acts = xnfreallocarray(to->button->xkb_acts, -+ maxbuttons, -+ sizeof(XkbAction)); -+ memset(to->button->xkb_acts, 0, maxbuttons * sizeof(XkbAction)); - memcpy(to->button->xkb_acts, from->button->xkb_acts, -- sizeof(XkbAction)); -+ from->button->numButtons * sizeof(XkbAction)); - } - else { - free(to->button->xkb_acts); -diff --git a/dix/devices.c b/dix/devices.c -index 7150734a5..20fef1692 100644 ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -2530,6 +2530,8 @@ RecalculateMasterButtons(DeviceIntPtr slave) - - if (master->button && master->button->numButtons != maxbuttons) { - int i; -+ int last_num_buttons = master->button->numButtons; -+ - DeviceChangedEvent event = { - .header = ET_Internal, - .type = ET_DeviceChanged, -@@ -2540,6 +2542,14 @@ RecalculateMasterButtons(DeviceIntPtr slave) - }; - - master->button->numButtons = maxbuttons; -+ if (last_num_buttons < maxbuttons) { -+ master->button->xkb_acts = xnfreallocarray(master->button->xkb_acts, -+ maxbuttons, -+ sizeof(XkbAction)); -+ memset(&master->button->xkb_acts[last_num_buttons], -+ 0, -+ (maxbuttons - last_num_buttons) * sizeof(XkbAction)); -+ } - - memcpy(&event.buttons.names, master->button->labels, maxbuttons * - sizeof(Atom)); --- -2.43.0 - diff --git a/SOURCES/0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch b/SOURCES/0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch deleted file mode 100644 index 595f75e..0000000 --- a/SOURCES/0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 8660dd164882ce5fc1f274427e2ff3dc020d6273 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 25 Jan 2023 11:41:40 +1000 -Subject: [PATCH xserver] Xi: fix potential use-after-free in - DeepCopyPointerClasses - -CVE-2023-0494, ZDI-CAN-19596 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -(cherry picked from commit 0ba6d8c37071131a49790243cdac55392ecf71ec) ---- - Xi/exevents.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/Xi/exevents.c b/Xi/exevents.c -index 217baa956..dcd4efb3b 100644 ---- a/Xi/exevents.c -+++ b/Xi/exevents.c -@@ -619,8 +619,10 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) - memcpy(to->button->xkb_acts, from->button->xkb_acts, - sizeof(XkbAction)); - } -- else -+ else { - free(to->button->xkb_acts); -+ to->button->xkb_acts = NULL; -+ } - - memcpy(to->button->labels, from->button->labels, - from->button->numButtons * sizeof(Atom)); --- -2.39.1 - diff --git a/SOURCES/0001-Xi-randr-fix-handling-of-PropModeAppend-Prepend.patch b/SOURCES/0001-Xi-randr-fix-handling-of-PropModeAppend-Prepend.patch deleted file mode 100644 index f98f71d..0000000 --- a/SOURCES/0001-Xi-randr-fix-handling-of-PropModeAppend-Prepend.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 1e8478455458e998dd366d2cd23d2aeab2bdeee5 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 3 Oct 2023 11:53:05 +1000 -Subject: [PATCH xserver] Xi/randr: fix handling of PropModeAppend/Prepend - -The handling of appending/prepending properties was incorrect, with at -least two bugs: the property length was set to the length of the new -part only, i.e. appending or prepending N elements to a property with P -existing elements always resulted in the property having N elements -instead of N + P. - -Second, when pre-pending a value to a property, the offset for the old -values was incorrect, leaving the new property with potentially -uninitalized values and/or resulting in OOB memory writes. -For example, prepending a 3 element value to a 5 element property would -result in this 8 value array: - [N, N, N, ?, ?, P, P, P ] P, P - ^OOB write - -The XI2 code is a copy/paste of the RandR code, so the bug exists in -both. - -CVE-2023-5367, ZDI-CAN-22153 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -(cherry picked from commit 541ab2ecd41d4d8689e71855d93e492bc554719a) ---- - Xi/xiproperty.c | 4 ++-- - randr/rrproperty.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c -index 066ba21fba..d315f04d0e 100644 ---- a/Xi/xiproperty.c -+++ b/Xi/xiproperty.c -@@ -730,7 +730,7 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type, - XIDestroyDeviceProperty(prop); - return BadAlloc; - } -- new_value.size = len; -+ new_value.size = total_len; - new_value.type = type; - new_value.format = format; - -@@ -747,7 +747,7 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type, - case PropModePrepend: - new_data = new_value.data; - old_data = (void *) (((char *) new_value.data) + -- (prop_value->size * size_in_bytes)); -+ (len * size_in_bytes)); - break; - } - if (new_data) -diff --git a/randr/rrproperty.c b/randr/rrproperty.c -index c2fb9585c6..25469f57b2 100644 ---- a/randr/rrproperty.c -+++ b/randr/rrproperty.c -@@ -209,7 +209,7 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, - RRDestroyOutputProperty(prop); - return BadAlloc; - } -- new_value.size = len; -+ new_value.size = total_len; - new_value.type = type; - new_value.format = format; - -@@ -226,7 +226,7 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, - case PropModePrepend: - new_data = new_value.data; - old_data = (void *) (((char *) new_value.data) + -- (prop_value->size * size_in_bytes)); -+ (len * size_in_bytes)); - break; - } - if (new_data) --- -2.41.0 - diff --git a/SOURCES/0001-Xtest-disallow-GenericEvents-in-XTestSwapFakeInput.patch b/SOURCES/0001-Xtest-disallow-GenericEvents-in-XTestSwapFakeInput.patch deleted file mode 100644 index fbb32c1..0000000 --- a/SOURCES/0001-Xtest-disallow-GenericEvents-in-XTestSwapFakeInput.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 8dba686dc277d6d262ad0c77b4632a5b276697ba Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 12:55:45 +1000 -Subject: [PATCH xserver 1/7] Xtest: disallow GenericEvents in - XTestSwapFakeInput - -XTestSwapFakeInput assumes all events in this request are -sizeof(xEvent) and iterates through these in 32-byte increments. -However, a GenericEvent may be of arbitrary length longer than 32 bytes, -so any GenericEvent in this list would result in subsequent events to be -misparsed. - -Additional, the swapped event is written into a stack-allocated struct -xEvent (size 32 bytes). For any GenericEvent longer than 32 bytes, -swapping the event may thus smash the stack like an avocado on toast. - -Catch this case early and return BadValue for any GenericEvent. -Which is what would happen in unswapped setups anyway since XTest -doesn't support GenericEvent. - -CVE-2022-46340, ZDI-CAN 19265 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xext/xtest.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/Xext/xtest.c b/Xext/xtest.c -index bf27eb590b..2985a4ce6e 100644 ---- a/Xext/xtest.c -+++ b/Xext/xtest.c -@@ -502,10 +502,11 @@ XTestSwapFakeInput(ClientPtr client, xReq * req) - - nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent); - for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) { -+ int evtype = ev->u.u.type & 0x177; - /* Swap event */ -- proc = EventSwapVector[ev->u.u.type & 0177]; -+ proc = EventSwapVector[evtype]; - /* no swapping proc; invalid event type? */ -- if (!proc || proc == NotImplemented) { -+ if (!proc || proc == NotImplemented || evtype == GenericEvent) { - client->errorValue = ev->u.u.type; - return BadValue; - } --- -2.38.1 diff --git a/SOURCES/0001-composite-Fix-use-after-free-of-the-COW.patch b/SOURCES/0001-composite-Fix-use-after-free-of-the-COW.patch deleted file mode 100644 index bb21d7e..0000000 --- a/SOURCES/0001-composite-Fix-use-after-free-of-the-COW.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 26ef545b3502f61ca722a7a3373507e88ef64110 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 13 Mar 2023 11:08:47 +0100 -Subject: [PATCH xserver] composite: Fix use-after-free of the COW - -ZDI-CAN-19866/CVE-2023-1393 - -If a client explicitly destroys the compositor overlay window (aka COW), -we would leave a dangling pointer to that window in the CompScreen -structure, which will trigger a use-after-free later. - -Make sure to clear the CompScreen pointer to the COW when the latter gets -destroyed explicitly by the client. - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Olivier Fourdan -Reviewed-by: Adam Jackson ---- - composite/compwindow.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/composite/compwindow.c b/composite/compwindow.c -index 4e2494b86..b30da589e 100644 ---- a/composite/compwindow.c -+++ b/composite/compwindow.c -@@ -620,6 +620,11 @@ compDestroyWindow(WindowPtr pWin) - ret = (*pScreen->DestroyWindow) (pWin); - cs->DestroyWindow = pScreen->DestroyWindow; - pScreen->DestroyWindow = compDestroyWindow; -+ -+ /* Did we just destroy the overlay window? */ -+ if (pWin == cs->pOverlayWin) -+ cs->pOverlayWin = NULL; -+ - /* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/ - return ret; - } --- -2.40.0 - diff --git a/SOURCES/0001-dix-allocate-enough-space-for-logical-button-maps.patch b/SOURCES/0001-dix-allocate-enough-space-for-logical-button-maps.patch deleted file mode 100644 index 581756a..0000000 --- a/SOURCES/0001-dix-allocate-enough-space-for-logical-button-maps.patch +++ /dev/null @@ -1,54 +0,0 @@ -From b5cb27032d3e486ba84a491e1420e85171c4c0a3 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 14 Dec 2023 11:29:49 +1000 -Subject: [PATCH xserver 1/9] dix: allocate enough space for logical button - maps - -Both DeviceFocusEvent and the XIQueryPointer reply contain a bit for -each logical button currently down. Since buttons can be arbitrarily mapped -to anything up to 255 make sure we have enough bits for the maximum mapping. - -CVE-2023-6816, ZDI-CAN-22664, ZDI-CAN-22665 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -(cherry picked from commit 9e2ecb2af8302dedc49cb6a63ebe063c58a9e7e3) ---- - Xi/xiquerypointer.c | 3 +-- - dix/enterleave.c | 5 +++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c -index 5b77b1a44..2b05ac5f3 100644 ---- a/Xi/xiquerypointer.c -+++ b/Xi/xiquerypointer.c -@@ -149,8 +149,7 @@ ProcXIQueryPointer(ClientPtr client) - if (pDev->button) { - int i; - -- rep.buttons_len = -- bytes_to_int32(bits_to_bytes(pDev->button->numButtons)); -+ rep.buttons_len = bytes_to_int32(bits_to_bytes(256)); /* button map up to 255 */ - rep.length += rep.buttons_len; - buttons = calloc(rep.buttons_len, 4); - if (!buttons) -diff --git a/dix/enterleave.c b/dix/enterleave.c -index 867ec7436..ded8679d7 100644 ---- a/dix/enterleave.c -+++ b/dix/enterleave.c -@@ -784,8 +784,9 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, - - mouse = IsFloating(dev) ? dev : GetMaster(dev, MASTER_POINTER); - -- /* XI 2 event */ -- btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; -+ /* XI 2 event contains the logical button map - maps are CARD8 -+ * so we need 256 bits for the possibly maximum mapping */ -+ btlen = (mouse->button) ? bits_to_bytes(256) : 0; - btlen = bytes_to_int32(btlen); - len = sizeof(xXIFocusInEvent) + btlen * 4; - --- -2.43.0 - diff --git a/SOURCES/0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch b/SOURCES/0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch deleted file mode 100644 index d9eea48..0000000 --- a/SOURCES/0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch +++ /dev/null @@ -1,105 +0,0 @@ -From b98fc07d3442a289c6bef82df50dd0a2d01de71a Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Thu, 2 Feb 2023 12:26:27 -0500 -Subject: [PATCH xserver] present: Send a PresentConfigureNotify event for - destroyed windows -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This enables fixing a deadlock case on the client side, where the client -ends up blocked waiting for a Present event that will never come because -the window was destroyed. The new PresentWindowDestroyed flag allows the -client to avoid blocking indefinitely. - -Signed-off-by: Adam Jackson -See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/116 -See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6685 -Reviewed-by: Michel Dänzer -(cherry picked from commit 462b06033e66a32308d940eb5fc47f5e4c914dc0) ---- - present/present_event.c | 5 +++-- - present/present_priv.h | 7 ++++++- - present/present_screen.c | 11 ++++++++++- - 3 files changed, 19 insertions(+), 4 deletions(-) - -diff --git a/present/present_event.c b/present/present_event.c -index 435b26b70..849732dc8 100644 ---- a/present/present_event.c -+++ b/present/present_event.c -@@ -102,7 +102,8 @@ present_event_swap(xGenericEvent *from, xGenericEvent *to) - } - - void --present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling) -+present_send_config_notify(WindowPtr window, int x, int y, int w, int h, -+ int bw, WindowPtr sibling, CARD32 flags) - { - present_window_priv_ptr window_priv = present_window_priv(window); - -@@ -122,7 +123,7 @@ present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, - .off_y = 0, - .pixmap_width = w, - .pixmap_height = h, -- .pixmap_flags = 0 -+ .pixmap_flags = flags - }; - present_event_ptr event; - -diff --git a/present/present_priv.h b/present/present_priv.h -index 6ebd009a2..4ad729864 100644 ---- a/present/present_priv.h -+++ b/present/present_priv.h -@@ -43,6 +43,11 @@ - #define DebugPresent(x) - #endif - -+/* XXX this belongs in presentproto */ -+#ifndef PresentWindowDestroyed -+#define PresentWindowDestroyed (1 << 0) -+#endif -+ - extern int present_request; - - extern DevPrivateKeyRec present_screen_private_key; -@@ -307,7 +312,7 @@ void - present_free_events(WindowPtr window); - - void --present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling); -+present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling, CARD32 flags); - - void - present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 serial, uint64_t ust, uint64_t msc); -diff --git a/present/present_screen.c b/present/present_screen.c -index 15684eda4..2c29aafd2 100644 ---- a/present/present_screen.c -+++ b/present/present_screen.c -@@ -93,6 +93,15 @@ present_destroy_window(WindowPtr window) - present_screen_priv_ptr screen_priv = present_screen_priv(screen); - present_window_priv_ptr window_priv = present_window_priv(window); - -+ present_send_config_notify(window, -+ window->drawable.x, -+ window->drawable.y, -+ window->drawable.width, -+ window->drawable.height, -+ window->borderWidth, -+ window->nextSib, -+ PresentWindowDestroyed); -+ - if (window_priv) { - present_clear_window_notifies(window); - present_free_events(window); -@@ -123,7 +132,7 @@ present_config_notify(WindowPtr window, - ScreenPtr screen = window->drawable.pScreen; - present_screen_priv_ptr screen_priv = present_screen_priv(screen); - -- present_send_config_notify(window, x, y, w, h, bw, sibling); -+ present_send_config_notify(window, x, y, w, h, bw, sibling, 0); - - unwrap(screen_priv, screen, ConfigNotify); - if (screen->ConfigNotify) --- -2.40.0 - diff --git a/SOURCES/0001-randr-avoid-integer-truncation-in-length-check-of-Pr.patch b/SOURCES/0001-randr-avoid-integer-truncation-in-length-check-of-Pr.patch deleted file mode 100644 index 430ead8..0000000 --- a/SOURCES/0001-randr-avoid-integer-truncation-in-length-check-of-Pr.patch +++ /dev/null @@ -1,61 +0,0 @@ -From aaf854fb25541380cc38a221c15f0e8372f48872 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Mon, 27 Nov 2023 16:27:49 +1000 -Subject: [PATCH xserver] randr: avoid integer truncation in length check of - ProcRRChange*Property - -Affected are ProcRRChangeProviderProperty and ProcRRChangeOutputProperty. -See also xserver@8f454b79 where this same bug was fixed for the core -protocol and XI. - -This fixes an OOB read and the resulting information disclosure. - -Length calculation for the request was clipped to a 32-bit integer. With -the correct stuff->nUnits value the expected request size was -truncated, passing the REQUEST_FIXED_SIZE check. - -The server then proceeded with reading at least stuff->num_items bytes -(depending on stuff->format) from the request and stuffing whatever it -finds into the property. In the process it would also allocate at least -stuff->nUnits bytes, i.e. 4GB. - -CVE-2023-6478, ZDI-CAN-22561 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -(cherry picked from commit 14f480010a93ff962fef66a16412fafff81ad632) ---- - randr/rrproperty.c | 2 +- - randr/rrproviderproperty.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/randr/rrproperty.c b/randr/rrproperty.c -index 25469f57b..c4fef8a1f 100644 ---- a/randr/rrproperty.c -+++ b/randr/rrproperty.c -@@ -530,7 +530,7 @@ ProcRRChangeOutputProperty(ClientPtr client) - char format, mode; - unsigned long len; - int sizeInBytes; -- int totalSize; -+ uint64_t totalSize; - int err; - - REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq); -diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c -index b79c17f9b..90c5a9a93 100644 ---- a/randr/rrproviderproperty.c -+++ b/randr/rrproviderproperty.c -@@ -498,7 +498,7 @@ ProcRRChangeProviderProperty(ClientPtr client) - char format, mode; - unsigned long len; - int sizeInBytes; -- int totalSize; -+ uint64_t totalSize; - int err; - - REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq); --- -2.43.0 - diff --git a/SOURCES/0001-record-Fix-out-of-bounds-access-in-SwapCreateRegiste.patch b/SOURCES/0001-record-Fix-out-of-bounds-access-in-SwapCreateRegiste.patch deleted file mode 100644 index 83e4ce2..0000000 --- a/SOURCES/0001-record-Fix-out-of-bounds-access-in-SwapCreateRegiste.patch +++ /dev/null @@ -1,35 +0,0 @@ -From a8644465d98beb08759546711b77bb617861c67f Mon Sep 17 00:00:00 2001 -From: Povilas Kanapickas -Date: Tue, 14 Dec 2021 15:00:00 +0200 -Subject: [PATCH xserver 1/4] record: Fix out of bounds access in - SwapCreateRegister() - -ZDI-CAN-14952, CVE-2021-4011 - -This vulnerability was discovered and the fix was suggested by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Povilas Kanapickas -(cherry picked from commit e56f61c79fc3cee26d83cda0f84ae56d5979f768) ---- - record/record.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/record/record.c b/record/record.c -index be154525d..e123867a7 100644 ---- a/record/record.c -+++ b/record/record.c -@@ -2516,8 +2516,8 @@ SwapCreateRegister(ClientPtr client, xRecordRegisterClientsReq * stuff) - swapl(pClientID); - } - if (stuff->nRanges > -- client->req_len - bytes_to_int32(sz_xRecordRegisterClientsReq) -- - stuff->nClients) -+ (client->req_len - bytes_to_int32(sz_xRecordRegisterClientsReq) -+ - stuff->nClients) / bytes_to_int32(sz_xRecordRange)) - return BadLength; - RecordSwapRanges((xRecordRange *) pClientID, stuff->nRanges); - return Success; --- -2.33.1 - diff --git a/SOURCES/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch b/SOURCES/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch deleted file mode 100644 index 6e5ebb5..0000000 --- a/SOURCES/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 18f91b950e22c2a342a4fbc55e9ddf7534a707d2 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 13 Jul 2022 11:23:09 +1000 -Subject: [PATCH xserver] xkb: fix some possible memleaks in XkbGetKbdByName - -GetComponentByName returns an allocated string, so let's free that if we -fail somewhere. - -Signed-off-by: Peter Hutterer ---- - xkb/xkb.c | 26 ++++++++++++++++++++------ - 1 file changed, 20 insertions(+), 6 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 4692895db..b79a269e3 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5935,18 +5935,32 @@ ProcXkbGetKbdByName(ClientPtr client) - xkb = dev->key->xkbInfo->desc; - status = Success; - str = (unsigned char *) &stuff[1]; -- if (GetComponentSpec(&str, TRUE, &status)) /* keymap, unsupported */ -- return BadMatch; -+ { -+ char *keymap = GetComponentSpec(&str, TRUE, &status); /* keymap, unsupported */ -+ if (keymap) { -+ free(keymap); -+ return BadMatch; -+ } -+ } - names.keycodes = GetComponentSpec(&str, TRUE, &status); - names.types = GetComponentSpec(&str, TRUE, &status); - names.compat = GetComponentSpec(&str, TRUE, &status); - names.symbols = GetComponentSpec(&str, TRUE, &status); - names.geometry = GetComponentSpec(&str, TRUE, &status); -- if (status != Success) -+ if (status == Success) { -+ len = str - ((unsigned char *) stuff); -+ if ((XkbPaddedSize(len) / 4) != stuff->length) -+ status = BadLength; -+ } -+ -+ if (status != Success) { -+ free(names.keycodes); -+ free(names.types); -+ free(names.compat); -+ free(names.symbols); -+ free(names.geometry); - return status; -- len = str - ((unsigned char *) stuff); -- if ((XkbPaddedSize(len) / 4) != stuff->length) -- return BadLength; -+ } - - CHK_MASK_LEGAL(0x01, stuff->want, XkbGBN_AllComponentsMask); - CHK_MASK_LEGAL(0x02, stuff->need, XkbGBN_AllComponentsMask); --- -2.38.1 - diff --git a/SOURCES/0001-xkb-proof-GetCountedString-against-request-length-at.patch b/SOURCES/0001-xkb-proof-GetCountedString-against-request-length-at.patch deleted file mode 100644 index d358a32..0000000 --- a/SOURCES/0001-xkb-proof-GetCountedString-against-request-length-at.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 11beef0b7f1ed290348e45618e5fa0d2bffcb72e Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 5 Jul 2022 12:06:20 +1000 -Subject: [PATCH xserver] xkb: proof GetCountedString against request length - attacks - -GetCountedString did a check for the whole string to be within the -request buffer but not for the initial 2 bytes that contain the length -field. A swapped client could send a malformed request to trigger a -swaps() on those bytes, writing into random memory. - -Signed-off-by: Peter Hutterer ---- - xkb/xkb.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index f42f59ef3..1841cff26 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5137,6 +5137,11 @@ _GetCountedString(char **wire_inout, ClientPtr client, char **str) - CARD16 len; - - wire = *wire_inout; -+ -+ if (client->req_len < -+ bytes_to_int32(wire + 2 - (char *) client->requestBuffer)) -+ return BadValue; -+ - len = *(CARD16 *) wire; - if (client->swapped) { - swaps(&len); --- -2.38.1 - diff --git a/SOURCES/0001-xkb-switch-to-array-index-loops-to-moving-pointers.patch b/SOURCES/0001-xkb-switch-to-array-index-loops-to-moving-pointers.patch deleted file mode 100644 index be7b84f..0000000 --- a/SOURCES/0001-xkb-switch-to-array-index-loops-to-moving-pointers.patch +++ /dev/null @@ -1,77 +0,0 @@ -From c9b379ec5a1a34692af06056925bd0fc5f809713 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 5 Jul 2022 12:40:47 +1000 -Subject: [PATCH xserver 1/3] xkb: switch to array index loops to moving - pointers - -Most similar loops here use a pointer that advances with each loop -iteration, let's do the same here for consistency. - -No functional changes. - -Signed-off-by: Peter Hutterer -Reviewed-by: Olivier Fourdan -(cherry picked from commit f1070c01d616c5f21f939d5ebc533738779451ac) ---- - xkb/xkb.c | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index d056c698c..684394d77 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5372,16 +5372,16 @@ _CheckSetSections(XkbGeometryPtr geom, - row->left = rWire->left; - row->vertical = rWire->vertical; - kWire = (xkbKeyWireDesc *) &rWire[1]; -- for (k = 0; k < rWire->nKeys; k++) { -+ for (k = 0; k < rWire->nKeys; k++, kWire++) { - XkbKeyPtr key; - - key = XkbAddGeomKey(row); - if (!key) - return BadAlloc; -- memcpy(key->name.name, kWire[k].name, XkbKeyNameLength); -- key->gap = kWire[k].gap; -- key->shape_ndx = kWire[k].shapeNdx; -- key->color_ndx = kWire[k].colorNdx; -+ memcpy(key->name.name, kWire->name, XkbKeyNameLength); -+ key->gap = kWire->gap; -+ key->shape_ndx = kWire->shapeNdx; -+ key->color_ndx = kWire->colorNdx; - if (key->shape_ndx >= geom->num_shapes) { - client->errorValue = _XkbErrCode3(0x10, key->shape_ndx, - geom->num_shapes); -@@ -5393,7 +5393,7 @@ _CheckSetSections(XkbGeometryPtr geom, - return BadMatch; - } - } -- rWire = (xkbRowWireDesc *) &kWire[rWire->nKeys]; -+ rWire = (xkbRowWireDesc *)kWire; - } - wire = (char *) rWire; - if (sWire->nDoodads > 0) { -@@ -5458,16 +5458,16 @@ _CheckSetShapes(XkbGeometryPtr geom, - return BadAlloc; - ol->corner_radius = olWire->cornerRadius; - ptWire = (xkbPointWireDesc *) &olWire[1]; -- for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) { -- pt->x = ptWire[p].x; -- pt->y = ptWire[p].y; -+ for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++, ptWire++) { -+ pt->x = ptWire->x; -+ pt->y = ptWire->y; - if (client->swapped) { - swaps(&pt->x); - swaps(&pt->y); - } - } - ol->num_points = olWire->nPoints; -- olWire = (xkbOutlineWireDesc *) (&ptWire[olWire->nPoints]); -+ olWire = (xkbOutlineWireDesc *)ptWire; - } - if (shapeWire->primaryNdx != XkbNoShape) - shape->primary = &shape->outlines[shapeWire->primaryNdx]; --- -2.36.1 - diff --git a/SOURCES/0001-xwayland-eglstream-Demote-EGLstream-device-warning.patch b/SOURCES/0001-xwayland-eglstream-Demote-EGLstream-device-warning.patch deleted file mode 100644 index 0114bc7..0000000 --- a/SOURCES/0001-xwayland-eglstream-Demote-EGLstream-device-warning.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0a7ed9ff7ea20f7b958a2ad9f9bd045080a3ad9a Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 15 Nov 2021 16:02:34 +0100 -Subject: [PATCH xserver 1/4] xwayland/eglstream: Demote EGLstream device - warning -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If no EGLstream capable device is found at startup, Xwayland's EGLstream -backend will log an error message "glamor: No eglstream capable devices -found". - -However, considering that the vast majority of drivers do not implement -EGLstream, the lack of EGLstream capable device is more of the norm than -the exception. - -Change the error message to a log verbose message. - -Signed-off-by: Olivier Fourdan -Reviewed-by: Simon Ser -Reviewed-by: Jonas Ådahl -(cherry picked from commit 96c82befa2c3f3dc3534743c67cc003c2106e9b0) ---- - hw/xwayland/xwayland-glamor-eglstream.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c -index 8d18caaf5..93d192d58 100644 ---- a/hw/xwayland/xwayland-glamor-eglstream.c -+++ b/hw/xwayland/xwayland-glamor-eglstream.c -@@ -1144,7 +1144,7 @@ xwl_eglstream_get_device(struct xwl_screen *xwl_screen) - free(devices); - out: - if (!device) -- ErrorF("glamor: No eglstream capable devices found\n"); -+ LogMessageVerb(X_INFO, 3, "glamor: No eglstream capable devices found\n"); - return device; - } - --- -2.33.1 - diff --git a/SOURCES/0002-Xi-return-an-error-from-XI-property-changes-if-verif.patch b/SOURCES/0002-Xi-return-an-error-from-XI-property-changes-if-verif.patch deleted file mode 100644 index 4f7ed86..0000000 --- a/SOURCES/0002-Xi-return-an-error-from-XI-property-changes-if-verif.patch +++ /dev/null @@ -1,40 +0,0 @@ -From c5ff57676698f19ed3a1402aef58a15552e32d27 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 13:24:00 +1000 -Subject: [PATCH xserver 2/7] Xi: return an error from XI property changes if - verification failed - -Both ProcXChangeDeviceProperty and ProcXIChangeProperty checked the -property for validity but didn't actually return the potential error. - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xi/xiproperty.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c -index a36f7d61df..68c362c628 100644 ---- a/Xi/xiproperty.c -+++ b/Xi/xiproperty.c -@@ -902,6 +902,8 @@ ProcXChangeDeviceProperty(ClientPtr client) - - rc = check_change_property(client, stuff->property, stuff->type, - stuff->format, stuff->mode, stuff->nUnits); -+ if (rc != Success) -+ return rc; - - len = stuff->nUnits; - if (len > (bytes_to_int32(0xffffffff - sizeof(xChangeDevicePropertyReq)))) -@@ -1141,6 +1143,9 @@ ProcXIChangeProperty(ClientPtr client) - - rc = check_change_property(client, stuff->property, stuff->type, - stuff->format, stuff->mode, stuff->num_items); -+ if (rc != Success) -+ return rc; -+ - len = stuff->num_items; - if (len > bytes_to_int32(0xffffffff - sizeof(xXIChangePropertyReq))) - return BadLength; --- -2.38.1 diff --git a/SOURCES/0002-dix-Allocate-sufficient-xEvents-for-our-DeviceStateN.patch b/SOURCES/0002-dix-Allocate-sufficient-xEvents-for-our-DeviceStateN.patch deleted file mode 100644 index b108272..0000000 --- a/SOURCES/0002-dix-Allocate-sufficient-xEvents-for-our-DeviceStateN.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 9105be1c51d6973dc8d7806108349bc152029ec5 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Mon, 18 Dec 2023 14:27:50 +1000 -Subject: [PATCH xserver 2/9] dix: Allocate sufficient xEvents for our - DeviceStateNotify - -If a device has both a button class and a key class and numButtons is -zero, we can get an OOB write due to event under-allocation. - -This function seems to assume a device has either keys or buttons, not -both. It has two virtually identical code paths, both of which assume -they're applying to the first event in the sequence. - -A device with both a key and button class triggered a logic bug - only -one xEvent was allocated but the deviceStateNotify pointer was pushed on -once per type. So effectively this logic code: - - int count = 1; - if (button && nbuttons > 32) count++; - if (key && nbuttons > 0) count++; - if (key && nkeys > 32) count++; // this is basically always true - // count is at 2 for our keys + zero button device - - ev = alloc(count * sizeof(xEvent)); - FixDeviceStateNotify(ev); - if (button) - FixDeviceStateNotify(ev++); - if (key) - FixDeviceStateNotify(ev++); // santa drops into the wrong chimney here - -If the device has more than 3 valuators, the OOB is pushed back - we're -off by one so it will happen when the last deviceValuator event is -written instead. - -Fix this by allocating the maximum number of events we may allocate. -Note that the current behavior is not protocol-correct anyway, this -patch fixes only the allocation issue. - -Note that this issue does not trigger if the device has at least one -button. While the server does not prevent a button class with zero -buttons, it is very unlikely. - -CVE-2024-0229, ZDI-CAN-22678 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -(cherry picked from commit ece23be888a93b741aa1209d1dbf64636109d6a5) ---- - dix/enterleave.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/dix/enterleave.c b/dix/enterleave.c -index ded8679d7..17964b00a 100644 ---- a/dix/enterleave.c -+++ b/dix/enterleave.c -@@ -675,7 +675,8 @@ static void - DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win) - { - int evcount = 1; -- deviceStateNotify *ev, *sev; -+ deviceStateNotify sev[6 + (MAX_VALUATORS + 2)/3]; -+ deviceStateNotify *ev; - deviceKeyStateNotify *kev; - deviceButtonStateNotify *bev; - -@@ -714,7 +715,7 @@ DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win) - } - } - -- sev = ev = xallocarray(evcount, sizeof(xEvent)); -+ ev = sev; - FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first); - - if (b != NULL) { -@@ -770,7 +771,6 @@ DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win) - - DeliverEventsToWindow(dev, win, (xEvent *) sev, evcount, - DeviceStateNotifyMask, NullGrab); -- free(sev); - } - - void --- -2.43.0 - diff --git a/SOURCES/0002-xfixes-Fix-out-of-bounds-access-in-ProcXFixesCreateP.patch b/SOURCES/0002-xfixes-Fix-out-of-bounds-access-in-ProcXFixesCreateP.patch deleted file mode 100644 index fe4f283..0000000 --- a/SOURCES/0002-xfixes-Fix-out-of-bounds-access-in-ProcXFixesCreateP.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 3eb5445f6f7fa9f86de87adc768105d42bdbcf74 Mon Sep 17 00:00:00 2001 -From: Povilas Kanapickas -Date: Tue, 14 Dec 2021 15:00:01 +0200 -Subject: [PATCH xserver 2/4] xfixes: Fix out of bounds access in - *ProcXFixesCreatePointerBarrier() - -ZDI-CAN-14950, CVE-2021-4009 - -This vulnerability was discovered and the fix was suggested by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Povilas Kanapickas -(cherry picked from commit b5196750099ae6ae582e1f46bd0a6dad29550e02) ---- - xfixes/cursor.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/xfixes/cursor.c b/xfixes/cursor.c -index 60580b88f..c5d4554b2 100644 ---- a/xfixes/cursor.c -+++ b/xfixes/cursor.c -@@ -1010,7 +1010,8 @@ ProcXFixesCreatePointerBarrier(ClientPtr client) - { - REQUEST(xXFixesCreatePointerBarrierReq); - -- REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices)); -+ REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, -+ pad_to_int32(stuff->num_devices * sizeof(CARD16))); - LEGAL_NEW_RESOURCE(stuff->barrier, client); - - return XICreatePointerBarrier(client, stuff); -@@ -1027,7 +1028,8 @@ SProcXFixesCreatePointerBarrier(ClientPtr client) - - swaps(&stuff->length); - swaps(&stuff->num_devices); -- REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices)); -+ REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, -+ pad_to_int32(stuff->num_devices * sizeof(CARD16))); - - swapl(&stuff->barrier); - swapl(&stuff->window); --- -2.33.1 - diff --git a/SOURCES/0002-xkb-swap-XkbSetDeviceInfo-and-XkbSetDeviceInfoCheck.patch b/SOURCES/0002-xkb-swap-XkbSetDeviceInfo-and-XkbSetDeviceInfoCheck.patch deleted file mode 100644 index 26cf147..0000000 --- a/SOURCES/0002-xkb-swap-XkbSetDeviceInfo-and-XkbSetDeviceInfoCheck.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 45a0af83129eb7dc244c5118360afc1972a686c7 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 5 Jul 2022 09:50:41 +1000 -Subject: [PATCH xserver 2/3] xkb: swap XkbSetDeviceInfo and - XkbSetDeviceInfoCheck - -XKB often uses a FooCheck and Foo function pair, the former is supposed -to check all values in the request and error out on BadLength, -BadValue, etc. The latter is then called once we're confident the values -are good (they may still fail on an individual device, but that's a -different topic). - -In the case of XkbSetDeviceInfo, those functions were incorrectly -named, with XkbSetDeviceInfo ending up as the checker function and -XkbSetDeviceInfoCheck as the setter function. As a result, the setter -function was called before the checker function, accessing request -data and modifying device state before we ensured that the data is -valid. - -In particular, the setter function relied on values being already -byte-swapped. This in turn could lead to potential OOB memory access. - -Fix this by correctly naming the functions and moving the length checks -over to the checker function. These were added in 87c64fc5b0 to the -wrong function, probably due to the incorrect naming. - -Fixes ZDI-CAN 16070, CVE-2022-2320. - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Introduced in c06e27b2f6fd9f7b9f827623a48876a225264132 - -Signed-off-by: Peter Hutterer -(cherry picked from commit dd8caf39e9e15d8f302e54045dd08d8ebf1025dc) ---- - xkb/xkb.c | 46 +++++++++++++++++++++++++--------------------- - 1 file changed, 25 insertions(+), 21 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 684394d77..36464a770 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -6554,7 +6554,8 @@ ProcXkbGetDeviceInfo(ClientPtr client) - static char * - CheckSetDeviceIndicators(char *wire, - DeviceIntPtr dev, -- int num, int *status_rtrn, ClientPtr client) -+ int num, int *status_rtrn, ClientPtr client, -+ xkbSetDeviceInfoReq * stuff) - { - xkbDeviceLedsWireDesc *ledWire; - int i; -@@ -6562,6 +6563,11 @@ CheckSetDeviceIndicators(char *wire, - - ledWire = (xkbDeviceLedsWireDesc *) wire; - for (i = 0; i < num; i++) { -+ if (!_XkbCheckRequestBounds(client, stuff, ledWire, ledWire + 1)) { -+ *status_rtrn = BadLength; -+ return (char *) ledWire; -+ } -+ - if (client->swapped) { - swaps(&ledWire->ledClass); - swaps(&ledWire->ledID); -@@ -6589,6 +6595,11 @@ CheckSetDeviceIndicators(char *wire, - atomWire = (CARD32 *) &ledWire[1]; - if (nNames > 0) { - for (n = 0; n < nNames; n++) { -+ if (!_XkbCheckRequestBounds(client, stuff, atomWire, atomWire + 1)) { -+ *status_rtrn = BadLength; -+ return (char *) atomWire; -+ } -+ - if (client->swapped) { - swapl(atomWire); - } -@@ -6600,6 +6611,10 @@ CheckSetDeviceIndicators(char *wire, - mapWire = (xkbIndicatorMapWireDesc *) atomWire; - if (nMaps > 0) { - for (n = 0; n < nMaps; n++) { -+ if (!_XkbCheckRequestBounds(client, stuff, mapWire, mapWire + 1)) { -+ *status_rtrn = BadLength; -+ return (char *) mapWire; -+ } - if (client->swapped) { - swaps(&mapWire->virtualMods); - swapl(&mapWire->ctrls); -@@ -6651,11 +6666,6 @@ SetDeviceIndicators(char *wire, - xkbIndicatorMapWireDesc *mapWire; - XkbSrvLedInfoPtr sli; - -- if (!_XkbCheckRequestBounds(client, stuff, ledWire, ledWire + 1)) { -- *status_rtrn = BadLength; -- return (char *) ledWire; -- } -- - namec = mapc = statec = 0; - sli = XkbFindSrvLedInfo(dev, ledWire->ledClass, ledWire->ledID, - XkbXI_IndicatorMapsMask); -@@ -6674,10 +6684,6 @@ SetDeviceIndicators(char *wire, - memset((char *) sli->names, 0, XkbNumIndicators * sizeof(Atom)); - for (n = 0, bit = 1; n < XkbNumIndicators; n++, bit <<= 1) { - if (ledWire->namesPresent & bit) { -- if (!_XkbCheckRequestBounds(client, stuff, atomWire, atomWire + 1)) { -- *status_rtrn = BadLength; -- return (char *) atomWire; -- } - sli->names[n] = (Atom) *atomWire; - if (sli->names[n] == None) - ledWire->namesPresent &= ~bit; -@@ -6695,10 +6701,6 @@ SetDeviceIndicators(char *wire, - if (ledWire->mapsPresent) { - for (n = 0, bit = 1; n < XkbNumIndicators; n++, bit <<= 1) { - if (ledWire->mapsPresent & bit) { -- if (!_XkbCheckRequestBounds(client, stuff, mapWire, mapWire + 1)) { -- *status_rtrn = BadLength; -- return (char *) mapWire; -- } - sli->maps[n].flags = mapWire->flags; - sli->maps[n].which_groups = mapWire->whichGroups; - sli->maps[n].groups = mapWire->groups; -@@ -6734,13 +6736,17 @@ SetDeviceIndicators(char *wire, - } - - static int --_XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev, -+_XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, - xkbSetDeviceInfoReq * stuff) - { - char *wire; - - wire = (char *) &stuff[1]; - if (stuff->change & XkbXI_ButtonActionsMask) { -+ int sz = stuff->nBtns * SIZEOF(xkbActionWireDesc); -+ if (!_XkbCheckRequestBounds(client, stuff, wire, (char *) wire + sz)) -+ return BadLength; -+ - if (!dev->button) { - client->errorValue = _XkbErrCode2(XkbErr_BadClass, ButtonClass); - return XkbKeyboardErrorCode; -@@ -6751,13 +6757,13 @@ _XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev, - dev->button->numButtons); - return BadMatch; - } -- wire += (stuff->nBtns * SIZEOF(xkbActionWireDesc)); -+ wire += sz; - } - if (stuff->change & XkbXI_IndicatorsMask) { - int status = Success; - - wire = CheckSetDeviceIndicators(wire, dev, stuff->nDeviceLedFBs, -- &status, client); -+ &status, client, stuff); - if (status != Success) - return status; - } -@@ -6768,8 +6774,8 @@ _XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev, - } - - static int --_XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, -- xkbSetDeviceInfoReq * stuff) -+_XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev, -+ xkbSetDeviceInfoReq * stuff) - { - char *wire; - xkbExtensionDeviceNotify ed; -@@ -6793,8 +6799,6 @@ _XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, - if (stuff->firstBtn + stuff->nBtns > nBtns) - return BadValue; - sz = stuff->nBtns * SIZEOF(xkbActionWireDesc); -- if (!_XkbCheckRequestBounds(client, stuff, wire, (char *) wire + sz)) -- return BadLength; - memcpy((char *) &acts[stuff->firstBtn], (char *) wire, sz); - wire += sz; - ed.reason |= XkbXI_ButtonActionsMask; --- -2.36.1 - diff --git a/SOURCES/0002-xwayland-glamor-Change-errors-to-verbose-messages.patch b/SOURCES/0002-xwayland-glamor-Change-errors-to-verbose-messages.patch deleted file mode 100644 index ea69f62..0000000 --- a/SOURCES/0002-xwayland-glamor-Change-errors-to-verbose-messages.patch +++ /dev/null @@ -1,88 +0,0 @@ -From a515f4f4336efb8a2adf9a3ac141129708297d80 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Mon, 29 Nov 2021 11:45:35 +0100 -Subject: [PATCH xserver 2/4] xwayland/glamor: Change errors to verbose - messages -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On a normal startup sequence, the Xwayland glamor backend would log -an error whenever a required Wayland protocol is missing. - -Those are not really errors though, more informational messages along -the glamor backend selection process. - -Demote those errors to verbose messages to reduce the verbosity of -Xwayland at startup by default. - -Signed-off-by: Olivier Fourdan -Reviewed-by: Jonas Ådahl -(cherry picked from commit 30d0d4a19be61dd7b61f5ced992cb299e6a38068) ---- - hw/xwayland/xwayland-glamor-eglstream.c | 6 ++++-- - hw/xwayland/xwayland-glamor-gbm.c | 2 +- - hw/xwayland/xwayland-glamor.c | 6 ++++-- - 3 files changed, 9 insertions(+), 5 deletions(-) - -diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c -index 93d192d58..5a20b452f 100644 ---- a/hw/xwayland/xwayland-glamor-eglstream.c -+++ b/hw/xwayland/xwayland-glamor-eglstream.c -@@ -753,12 +753,14 @@ xwl_glamor_eglstream_has_wl_interfaces(struct xwl_screen *xwl_screen) - xwl_eglstream_get(xwl_screen); - - if (xwl_eglstream->display == NULL) { -- ErrorF("glamor: 'wl_eglstream_display' not supported\n"); -+ LogMessageVerb(X_INFO, 3, -+ "glamor: 'wl_eglstream_display' not supported\n"); - return FALSE; - } - - if (xwl_eglstream->controller == NULL) { -- ErrorF("glamor: 'wl_eglstream_controller' not supported\n"); -+ LogMessageVerb(X_INFO, 3, -+ "glamor: 'wl_eglstream_controller' not supported\n"); - return FALSE; - } - -diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c -index 466a1b052..e06b6f54b 100644 ---- a/hw/xwayland/xwayland-glamor-gbm.c -+++ b/hw/xwayland/xwayland-glamor-gbm.c -@@ -835,7 +835,7 @@ xwl_glamor_gbm_has_wl_interfaces(struct xwl_screen *xwl_screen) - struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); - - if (xwl_gbm->drm == NULL) { -- ErrorF("glamor: 'wl_drm' not supported\n"); -+ LogMessageVerb(X_INFO, 3, "glamor: 'wl_drm' not supported\n"); - return FALSE; - } - -diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c -index deb398f91..541d5e923 100644 ---- a/hw/xwayland/xwayland-glamor.c -+++ b/hw/xwayland/xwayland-glamor.c -@@ -412,7 +412,8 @@ xwl_glamor_select_gbm_backend(struct xwl_screen *xwl_screen) - return TRUE; - } - else -- ErrorF("Missing Wayland requirements for glamor GBM backend\n"); -+ LogMessageVerb(X_INFO, 3, -+ "Missing Wayland requirements for glamor GBM backend\n"); - #endif - - return FALSE; -@@ -428,7 +429,8 @@ xwl_glamor_select_eglstream_backend(struct xwl_screen *xwl_screen) - return TRUE; - } - else -- ErrorF("Missing Wayland requirements for glamor EGLStream backend\n"); -+ LogMessageVerb(X_INFO, 3, -+ "Missing Wayland requirements for glamor EGLStream backend\n"); - #endif - - return FALSE; --- -2.33.1 - diff --git a/SOURCES/0003-Xext-Fix-out-of-bounds-access-in-SProcScreenSaverSus.patch b/SOURCES/0003-Xext-Fix-out-of-bounds-access-in-SProcScreenSaverSus.patch deleted file mode 100644 index 60f2218..0000000 --- a/SOURCES/0003-Xext-Fix-out-of-bounds-access-in-SProcScreenSaverSus.patch +++ /dev/null @@ -1,34 +0,0 @@ -From fe0c050276c09f43cc1ae80b4553db42398ca84c Mon Sep 17 00:00:00 2001 -From: Povilas Kanapickas -Date: Tue, 14 Dec 2021 15:00:02 +0200 -Subject: [PATCH xserver 3/4] Xext: Fix out of bounds access in - SProcScreenSaverSuspend() - -ZDI-CAN-14951, CVE-2021-4010 - -This vulnerability was discovered and the fix was suggested by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Povilas Kanapickas -(cherry picked from commit 6c4c53010772e3cb4cb8acd54950c8eec9c00d21) ---- - Xext/saver.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Xext/saver.c b/Xext/saver.c -index 1d7e3cadf..f813ba08d 100644 ---- a/Xext/saver.c -+++ b/Xext/saver.c -@@ -1351,8 +1351,8 @@ SProcScreenSaverSuspend(ClientPtr client) - REQUEST(xScreenSaverSuspendReq); - - swaps(&stuff->length); -- swapl(&stuff->suspend); - REQUEST_SIZE_MATCH(xScreenSaverSuspendReq); -+ swapl(&stuff->suspend); - return ProcScreenSaverSuspend(client); - } - --- -2.33.1 - diff --git a/SOURCES/0003-Xi-avoid-integer-truncation-in-length-check-of-ProcX.patch b/SOURCES/0003-Xi-avoid-integer-truncation-in-length-check-of-ProcX.patch deleted file mode 100644 index a589a04..0000000 --- a/SOURCES/0003-Xi-avoid-integer-truncation-in-length-check-of-ProcX.patch +++ /dev/null @@ -1,70 +0,0 @@ -From f9c435822c852659e3926502829f1b13ce6efc37 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 13:26:57 +1000 -Subject: [PATCH xserver 3/7] Xi: avoid integer truncation in length check of - ProcXIChangeProperty - -This fixes an OOB read and the resulting information disclosure. - -Length calculation for the request was clipped to a 32-bit integer. With -the correct stuff->num_items value the expected request size was -truncated, passing the REQUEST_FIXED_SIZE check. - -The server then proceeded with reading at least stuff->num_items bytes -(depending on stuff->format) from the request and stuffing whatever it -finds into the property. In the process it would also allocate at least -stuff->num_items bytes, i.e. 4GB. - -The same bug exists in ProcChangeProperty and ProcXChangeDeviceProperty, -so let's fix that too. - -CVE-2022-46344, ZDI-CAN 19405 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xi/xiproperty.c | 4 ++-- - dix/property.c | 3 ++- - 2 files changed, 4 insertions(+), 3 deletions(-) - -diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c -index 68c362c628..066ba21fba 100644 ---- a/Xi/xiproperty.c -+++ b/Xi/xiproperty.c -@@ -890,7 +890,7 @@ ProcXChangeDeviceProperty(ClientPtr client) - REQUEST(xChangeDevicePropertyReq); - DeviceIntPtr dev; - unsigned long len; -- int totalSize; -+ uint64_t totalSize; - int rc; - - REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq); -@@ -1130,7 +1130,7 @@ ProcXIChangeProperty(ClientPtr client) - { - int rc; - DeviceIntPtr dev; -- int totalSize; -+ uint64_t totalSize; - unsigned long len; - - REQUEST(xXIChangePropertyReq); -diff --git a/dix/property.c b/dix/property.c -index 94ef5a0ec0..acce94b2c6 100644 ---- a/dix/property.c -+++ b/dix/property.c -@@ -205,7 +205,8 @@ ProcChangeProperty(ClientPtr client) - WindowPtr pWin; - char format, mode; - unsigned long len; -- int sizeInBytes, totalSize, err; -+ int sizeInBytes, err; -+ uint64_t totalSize; - - REQUEST(xChangePropertyReq); - --- -2.38.1 diff --git a/SOURCES/0003-dix-fix-DeviceStateNotify-event-calculation.patch b/SOURCES/0003-dix-fix-DeviceStateNotify-event-calculation.patch deleted file mode 100644 index add5867..0000000 --- a/SOURCES/0003-dix-fix-DeviceStateNotify-event-calculation.patch +++ /dev/null @@ -1,219 +0,0 @@ -From ee5377d94ea587f584adbc9ab8372b3842cfa149 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Mon, 18 Dec 2023 12:26:20 +1000 -Subject: [PATCH xserver 3/9] dix: fix DeviceStateNotify event calculation - -The previous code only made sense if one considers buttons and keys to -be mutually exclusive on a device. That is not necessarily true, causing -a number of issues. - -This function allocates and fills in the number of xEvents we need to -send the device state down the wire. This is split across multiple -32-byte devices including one deviceStateNotify event and optional -deviceKeyStateNotify, deviceButtonStateNotify and (possibly multiple) -deviceValuator events. - -The previous behavior would instead compose a sequence -of [state, buttonstate, state, keystate, valuator...]. This is not -protocol correct, and on top of that made the code extremely convoluted. - -Fix this by streamlining: add both button and key into the deviceStateNotify -and then append the key state and button state, followed by the -valuators. Finally, the deviceValuator events contain up to 6 valuators -per event but we only ever sent through 3 at a time. Let's double that -troughput. - -CVE-2024-0229, ZDI-CAN-22678 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -(cherry picked from commit 219c54b8a3337456ce5270ded6a67bcde53553d5) ---- - dix/enterleave.c | 121 ++++++++++++++++++++--------------------------- - 1 file changed, 52 insertions(+), 69 deletions(-) - -diff --git a/dix/enterleave.c b/dix/enterleave.c -index 17964b00a..7b7ba1098 100644 ---- a/dix/enterleave.c -+++ b/dix/enterleave.c -@@ -615,9 +615,15 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, - - ev->type = DeviceValuator; - ev->deviceid = dev->id; -- ev->num_valuators = nval < 3 ? nval : 3; -+ ev->num_valuators = nval < 6 ? nval : 6; - ev->first_valuator = first; - switch (ev->num_valuators) { -+ case 6: -+ ev->valuator2 = v->axisVal[first + 5]; -+ case 5: -+ ev->valuator2 = v->axisVal[first + 4]; -+ case 4: -+ ev->valuator2 = v->axisVal[first + 3]; - case 3: - ev->valuator2 = v->axisVal[first + 2]; - case 2: -@@ -626,7 +632,6 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, - ev->valuator0 = v->axisVal[first]; - break; - } -- first += ev->num_valuators; - } - - static void -@@ -646,7 +651,7 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, - ev->num_buttons = b->numButtons; - memcpy((char *) ev->buttons, (char *) b->down, 4); - } -- else if (k) { -+ if (k) { - ev->classes_reported |= (1 << KeyClass); - ev->num_keys = k->xkbInfo->desc->max_key_code - - k->xkbInfo->desc->min_key_code; -@@ -670,15 +675,26 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, - } - } - -- -+/** -+ * The device state notify event is split across multiple 32-byte events. -+ * The first one contains the first 32 button state bits, the first 32 -+ * key state bits, and the first 3 valuator values. -+ * -+ * If a device has more than that, the server sends out: -+ * - one deviceButtonStateNotify for buttons 32 and above -+ * - one deviceKeyStateNotify for keys 32 and above -+ * - one deviceValuator event per 6 valuators above valuator 4 -+ * -+ * All events but the last one have the deviceid binary ORed with MORE_EVENTS, -+ */ - static void - DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win) - { -+ /* deviceStateNotify, deviceKeyStateNotify, deviceButtonStateNotify -+ * and one deviceValuator for each 6 valuators */ -+ deviceStateNotify sev[3 + (MAX_VALUATORS + 6)/6]; - int evcount = 1; -- deviceStateNotify sev[6 + (MAX_VALUATORS + 2)/3]; -- deviceStateNotify *ev; -- deviceKeyStateNotify *kev; -- deviceButtonStateNotify *bev; -+ deviceStateNotify *ev = sev; - - KeyClassPtr k; - ButtonClassPtr b; -@@ -691,82 +707,49 @@ DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win) - - if ((b = dev->button) != NULL) { - nbuttons = b->numButtons; -- if (nbuttons > 32) -+ if (nbuttons > 32) /* first 32 are encoded in deviceStateNotify */ - evcount++; - } - if ((k = dev->key) != NULL) { - nkeys = k->xkbInfo->desc->max_key_code - k->xkbInfo->desc->min_key_code; -- if (nkeys > 32) -+ if (nkeys > 32) /* first 32 are encoded in deviceStateNotify */ - evcount++; -- if (nbuttons > 0) { -- evcount++; -- } - } - if ((v = dev->valuator) != NULL) { - nval = v->numAxes; -- -- if (nval > 3) -- evcount++; -- if (nval > 6) { -- if (!(k && b)) -- evcount++; -- if (nval > 9) -- evcount += ((nval - 7) / 3); -- } -+ /* first three are encoded in deviceStateNotify, then -+ * it's 6 per deviceValuator event */ -+ evcount += ((nval - 3) + 6)/6; - } - -- ev = sev; -- FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first); -- -- if (b != NULL) { -- FixDeviceStateNotify(dev, ev++, NULL, b, v, first); -- first += 3; -- nval -= 3; -- if (nbuttons > 32) { -- (ev - 1)->deviceid |= MORE_EVENTS; -- bev = (deviceButtonStateNotify *) ev++; -- bev->type = DeviceButtonStateNotify; -- bev->deviceid = dev->id; -- memcpy((char *) &bev->buttons[4], (char *) &b->down[4], -- DOWN_LENGTH - 4); -- } -- if (nval > 0) { -- (ev - 1)->deviceid |= MORE_EVENTS; -- FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); -- first += 3; -- nval -= 3; -- } -+ BUG_RETURN(evcount <= ARRAY_SIZE(sev)); -+ -+ FixDeviceStateNotify(dev, ev, k, b, v, first); -+ -+ if (b != NULL && nbuttons > 32) { -+ deviceButtonStateNotify *bev = (deviceButtonStateNotify *) ++ev; -+ (ev - 1)->deviceid |= MORE_EVENTS; -+ bev->type = DeviceButtonStateNotify; -+ bev->deviceid = dev->id; -+ memcpy((char *) &bev->buttons[4], (char *) &b->down[4], -+ DOWN_LENGTH - 4); - } - -- if (k != NULL) { -- FixDeviceStateNotify(dev, ev++, k, NULL, v, first); -- first += 3; -- nval -= 3; -- if (nkeys > 32) { -- (ev - 1)->deviceid |= MORE_EVENTS; -- kev = (deviceKeyStateNotify *) ev++; -- kev->type = DeviceKeyStateNotify; -- kev->deviceid = dev->id; -- memmove((char *) &kev->keys[0], (char *) &k->down[4], 28); -- } -- if (nval > 0) { -- (ev - 1)->deviceid |= MORE_EVENTS; -- FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); -- first += 3; -- nval -= 3; -- } -+ if (k != NULL && nkeys > 32) { -+ deviceKeyStateNotify *kev = (deviceKeyStateNotify *) ++ev; -+ (ev - 1)->deviceid |= MORE_EVENTS; -+ kev->type = DeviceKeyStateNotify; -+ kev->deviceid = dev->id; -+ memmove((char *) &kev->keys[0], (char *) &k->down[4], 28); - } - -+ first = 3; -+ nval -= 3; - while (nval > 0) { -- FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first); -- first += 3; -- nval -= 3; -- if (nval > 0) { -- (ev - 1)->deviceid |= MORE_EVENTS; -- FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); -- first += 3; -- nval -= 3; -- } -+ ev->deviceid |= MORE_EVENTS; -+ FixDeviceValuator(dev, (deviceValuator *) ++ev, v, first); -+ first += 6; -+ nval -= 6; - } - - DeliverEventsToWindow(dev, win, (xEvent *) sev, evcount, --- -2.43.0 - diff --git a/SOURCES/0003-xkb-add-request-length-validation-for-XkbSetGeometry.patch b/SOURCES/0003-xkb-add-request-length-validation-for-XkbSetGeometry.patch deleted file mode 100644 index 4200896..0000000 --- a/SOURCES/0003-xkb-add-request-length-validation-for-XkbSetGeometry.patch +++ /dev/null @@ -1,183 +0,0 @@ -From bd134231e282d9eb126b6fdaa40bb383180fa72b Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 5 Jul 2022 11:11:06 +1000 -Subject: [PATCH xserver 3/3] xkb: add request length validation for - XkbSetGeometry - -No validation of the various fields on that report were done, so a -malicious client could send a short request that claims it had N -sections, or rows, or keys, and the server would process the request for -N sections, running out of bounds of the actual request data. - -Fix this by adding size checks to ensure our data is valid. - -ZDI-CAN 16062, CVE-2022-2319. - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -(cherry picked from commit 6907b6ea2b4ce949cb07271f5b678d5966d9df42) ---- - xkb/xkb.c | 43 ++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 38 insertions(+), 5 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 36464a770..27d19793e 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5160,7 +5160,7 @@ _GetCountedString(char **wire_inout, ClientPtr client, char **str) - } - - static Status --_CheckSetDoodad(char **wire_inout, -+_CheckSetDoodad(char **wire_inout, xkbSetGeometryReq *req, - XkbGeometryPtr geom, XkbSectionPtr section, ClientPtr client) - { - char *wire; -@@ -5171,6 +5171,9 @@ _CheckSetDoodad(char **wire_inout, - Status status; - - dWire = (xkbDoodadWireDesc *) (*wire_inout); -+ if (!_XkbCheckRequestBounds(client, req, dWire, dWire + 1)) -+ return BadLength; -+ - any = dWire->any; - wire = (char *) &dWire[1]; - if (client->swapped) { -@@ -5273,7 +5276,7 @@ _CheckSetDoodad(char **wire_inout, - } - - static Status --_CheckSetOverlay(char **wire_inout, -+_CheckSetOverlay(char **wire_inout, xkbSetGeometryReq *req, - XkbGeometryPtr geom, XkbSectionPtr section, ClientPtr client) - { - register int r; -@@ -5284,6 +5287,9 @@ _CheckSetOverlay(char **wire_inout, - - wire = *wire_inout; - olWire = (xkbOverlayWireDesc *) wire; -+ if (!_XkbCheckRequestBounds(client, req, olWire, olWire + 1)) -+ return BadLength; -+ - if (client->swapped) { - swapl(&olWire->name); - } -@@ -5295,6 +5301,9 @@ _CheckSetOverlay(char **wire_inout, - xkbOverlayKeyWireDesc *kWire; - XkbOverlayRowPtr row; - -+ if (!_XkbCheckRequestBounds(client, req, rWire, rWire + 1)) -+ return BadLength; -+ - if (rWire->rowUnder > section->num_rows) { - client->errorValue = _XkbErrCode4(0x20, r, section->num_rows, - rWire->rowUnder); -@@ -5303,6 +5312,9 @@ _CheckSetOverlay(char **wire_inout, - row = XkbAddGeomOverlayRow(ol, rWire->rowUnder, rWire->nKeys); - kWire = (xkbOverlayKeyWireDesc *) &rWire[1]; - for (k = 0; k < rWire->nKeys; k++, kWire++) { -+ if (!_XkbCheckRequestBounds(client, req, kWire, kWire + 1)) -+ return BadLength; -+ - if (XkbAddGeomOverlayKey(ol, row, - (char *) kWire->over, - (char *) kWire->under) == NULL) { -@@ -5336,6 +5348,9 @@ _CheckSetSections(XkbGeometryPtr geom, - register int r; - xkbRowWireDesc *rWire; - -+ if (!_XkbCheckRequestBounds(client, req, sWire, sWire + 1)) -+ return BadLength; -+ - if (client->swapped) { - swapl(&sWire->name); - swaps(&sWire->top); -@@ -5361,6 +5376,9 @@ _CheckSetSections(XkbGeometryPtr geom, - XkbRowPtr row; - xkbKeyWireDesc *kWire; - -+ if (!_XkbCheckRequestBounds(client, req, rWire, rWire + 1)) -+ return BadLength; -+ - if (client->swapped) { - swaps(&rWire->top); - swaps(&rWire->left); -@@ -5375,6 +5393,9 @@ _CheckSetSections(XkbGeometryPtr geom, - for (k = 0; k < rWire->nKeys; k++, kWire++) { - XkbKeyPtr key; - -+ if (!_XkbCheckRequestBounds(client, req, kWire, kWire + 1)) -+ return BadLength; -+ - key = XkbAddGeomKey(row); - if (!key) - return BadAlloc; -@@ -5400,7 +5421,7 @@ _CheckSetSections(XkbGeometryPtr geom, - register int d; - - for (d = 0; d < sWire->nDoodads; d++) { -- status = _CheckSetDoodad(&wire, geom, section, client); -+ status = _CheckSetDoodad(&wire, req, geom, section, client); - if (status != Success) - return status; - } -@@ -5409,7 +5430,7 @@ _CheckSetSections(XkbGeometryPtr geom, - register int o; - - for (o = 0; o < sWire->nOverlays; o++) { -- status = _CheckSetOverlay(&wire, geom, section, client); -+ status = _CheckSetOverlay(&wire, req, geom, section, client); - if (status != Success) - return status; - } -@@ -5443,6 +5464,9 @@ _CheckSetShapes(XkbGeometryPtr geom, - xkbOutlineWireDesc *olWire; - XkbOutlinePtr ol; - -+ if (!_XkbCheckRequestBounds(client, req, shapeWire, shapeWire + 1)) -+ return BadLength; -+ - shape = - XkbAddGeomShape(geom, shapeWire->name, shapeWire->nOutlines); - if (!shape) -@@ -5453,12 +5477,18 @@ _CheckSetShapes(XkbGeometryPtr geom, - XkbPointPtr pt; - xkbPointWireDesc *ptWire; - -+ if (!_XkbCheckRequestBounds(client, req, olWire, olWire + 1)) -+ return BadLength; -+ - ol = XkbAddGeomOutline(shape, olWire->nPoints); - if (!ol) - return BadAlloc; - ol->corner_radius = olWire->cornerRadius; - ptWire = (xkbPointWireDesc *) &olWire[1]; - for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++, ptWire++) { -+ if (!_XkbCheckRequestBounds(client, req, ptWire, ptWire + 1)) -+ return BadLength; -+ - pt->x = ptWire->x; - pt->y = ptWire->y; - if (client->swapped) { -@@ -5564,12 +5594,15 @@ _CheckSetGeom(XkbGeometryPtr geom, xkbSetGeometryReq * req, ClientPtr client) - return status; - - for (i = 0; i < req->nDoodads; i++) { -- status = _CheckSetDoodad(&wire, geom, NULL, client); -+ status = _CheckSetDoodad(&wire, req, geom, NULL, client); - if (status != Success) - return status; - } - - for (i = 0; i < req->nKeyAliases; i++) { -+ if (!_XkbCheckRequestBounds(client, req, wire, wire + XkbKeyNameLength)) -+ return BadLength; -+ - if (XkbAddGeomKeyAlias(geom, &wire[XkbKeyNameLength], wire) == NULL) - return BadAlloc; - wire += 2 * XkbKeyNameLength; --- -2.36.1 - diff --git a/SOURCES/0003-xwayland-glamor-Log-backend-selected-for-debug.patch b/SOURCES/0003-xwayland-glamor-Log-backend-selected-for-debug.patch deleted file mode 100644 index 3d231cd..0000000 --- a/SOURCES/0003-xwayland-glamor-Log-backend-selected-for-debug.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 3206e133cb768709d32f260ac4b1bb17a46141a7 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 17 Nov 2021 13:09:58 +0100 -Subject: [PATCH xserver 3/4] xwayland/glamor: Log backend selected for debug -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add (verbose) statements to trace the actual backend used with glamor. - -That can be useful for debugging. - -Signed-off-by: Olivier Fourdan -Reviewed-by: Michel Dänzer -(cherry picked from commit c5d1fed9fa32244739677ec5c58ea87b261e023b) ---- - hw/xwayland/xwayland-glamor.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c -index 541d5e923..b34eafabb 100644 ---- a/hw/xwayland/xwayland-glamor.c -+++ b/hw/xwayland/xwayland-glamor.c -@@ -409,6 +409,7 @@ xwl_glamor_select_gbm_backend(struct xwl_screen *xwl_screen) - if (xwl_screen->gbm_backend.is_available && - xwl_glamor_has_wl_interfaces(xwl_screen, &xwl_screen->gbm_backend)) { - xwl_screen->egl_backend = &xwl_screen->gbm_backend; -+ LogMessageVerb(X_INFO, 3, "glamor: Using GBM backend\n"); - return TRUE; - } - else -@@ -426,6 +427,7 @@ xwl_glamor_select_eglstream_backend(struct xwl_screen *xwl_screen) - if (xwl_screen->eglstream_backend.is_available && - xwl_glamor_has_wl_interfaces(xwl_screen, &xwl_screen->eglstream_backend)) { - xwl_screen->egl_backend = &xwl_screen->eglstream_backend; -+ LogMessageVerb(X_INFO, 3, "glamor: Using EGLStream backend\n"); - return TRUE; - } - else --- -2.33.1 - diff --git a/SOURCES/0004-Xi-disallow-passive-grabs-with-a-detail-255.patch b/SOURCES/0004-Xi-disallow-passive-grabs-with-a-detail-255.patch deleted file mode 100644 index 1ae1754..0000000 --- a/SOURCES/0004-Xi-disallow-passive-grabs-with-a-detail-255.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0dab0b527ac5c4fe0272ea679522bd87238a733b Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 13:55:32 +1000 -Subject: [PATCH xserver 4/7] Xi: disallow passive grabs with a detail > 255 - -The XKB protocol effectively prevents us from ever using keycodes above -255. For buttons it's theoretically possible but realistically too niche -to worry about. For all other passive grabs, the detail must be zero -anyway. - -This fixes an OOB write: - -ProcXIPassiveUngrabDevice() calls DeletePassiveGrabFromList with a -temporary grab struct which contains tempGrab->detail.exact = stuff->detail. -For matching existing grabs, DeleteDetailFromMask is called with the -stuff->detail value. This function creates a new mask with the one bit -representing stuff->detail cleared. - -However, the array size for the new mask is 8 * sizeof(CARD32) bits, -thus any detail above 255 results in an OOB array write. - -CVE-2022-46341, ZDI-CAN 19381 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xi/xipassivegrab.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c -index 65d5870f6f..89a591098a 100644 ---- a/Xi/xipassivegrab.c -+++ b/Xi/xipassivegrab.c -@@ -133,6 +133,12 @@ ProcXIPassiveGrabDevice(ClientPtr client) - return BadValue; - } - -+ /* XI2 allows 32-bit keycodes but thanks to XKB we can never -+ * implement this. Just return an error for all keycodes that -+ * cannot work anyway, same for buttons > 255. */ -+ if (stuff->detail > 255) -+ return XIAlreadyGrabbed; -+ - if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1], - stuff->mask_len * 4) != Success) - return BadValue; -@@ -313,6 +319,12 @@ ProcXIPassiveUngrabDevice(ClientPtr client) - return BadValue; - } - -+ /* We don't allow passive grabs for details > 255 anyway */ -+ if (stuff->detail > 255) { -+ client->errorValue = stuff->detail; -+ return BadValue; -+ } -+ - rc = dixLookupWindow(&win, stuff->grab_window, client, DixSetAttrAccess); - if (rc != Success) - return rc; --- -2.38.1 diff --git a/SOURCES/0004-Xi-when-creating-a-new-ButtonClass-set-the-number-of.patch b/SOURCES/0004-Xi-when-creating-a-new-ButtonClass-set-the-number-of.patch deleted file mode 100644 index 3f13a70..0000000 --- a/SOURCES/0004-Xi-when-creating-a-new-ButtonClass-set-the-number-of.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 1c22e4a35e71d98a082ad2f8f7bc778a8859e18d Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 21 Dec 2023 13:48:10 +1000 -Subject: [PATCH xserver 4/9] Xi: when creating a new ButtonClass, set the - number of buttons - -There's a racy sequence where a master device may copy the button class -from the slave, without ever initializing numButtons. This leads to a -device with zero buttons but a button class which is invalid. - -Let's copy the numButtons value from the source - by definition if we -don't have a button class yet we do not have any other slave devices -with more than this number of buttons anyway. - -CVE-2024-0229, ZDI-CAN-22678 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -(cherry picked from commit df3c65706eb169d5938df0052059f3e0d5981b74) ---- - Xi/exevents.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Xi/exevents.c b/Xi/exevents.c -index 54ea11a93..e16171468 100644 ---- a/Xi/exevents.c -+++ b/Xi/exevents.c -@@ -605,6 +605,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) - to->button = calloc(1, sizeof(ButtonClassRec)); - if (!to->button) - FatalError("[Xi] no memory for class shift.\n"); -+ to->button->numButtons = from->button->numButtons; - } - else - classes->button = NULL; --- -2.43.0 - diff --git a/SOURCES/0004-render-Fix-out-of-bounds-access-in-SProcRenderCompos.patch b/SOURCES/0004-render-Fix-out-of-bounds-access-in-SProcRenderCompos.patch deleted file mode 100644 index 59c0762..0000000 --- a/SOURCES/0004-render-Fix-out-of-bounds-access-in-SProcRenderCompos.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 59c977bff66de77bd93ce8853e33e1b4ca661a49 Mon Sep 17 00:00:00 2001 -From: Povilas Kanapickas -Date: Tue, 14 Dec 2021 15:00:03 +0200 -Subject: [PATCH xserver 4/4] render: Fix out of bounds access in - SProcRenderCompositeGlyphs() - -ZDI-CAN-14192, CVE-2021-4008 - -This vulnerability was discovered and the fix was suggested by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Povilas Kanapickas -(cherry picked from commit ebce7e2d80e7c80e1dda60f2f0bc886f1106ba60) ---- - render/render.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/render/render.c b/render/render.c -index c376090ca..456f156d4 100644 ---- a/render/render.c -+++ b/render/render.c -@@ -2309,6 +2309,9 @@ SProcRenderCompositeGlyphs(ClientPtr client) - - i = elt->len; - if (i == 0xff) { -+ if (buffer + 4 > end) { -+ return BadLength; -+ } - swapl((int *) buffer); - buffer += 4; - } -@@ -2319,12 +2322,18 @@ SProcRenderCompositeGlyphs(ClientPtr client) - buffer += i; - break; - case 2: -+ if (buffer + i * 2 > end) { -+ return BadLength; -+ } - while (i--) { - swaps((short *) buffer); - buffer += 2; - } - break; - case 4: -+ if (buffer + i * 4 > end) { -+ return BadLength; -+ } - while (i--) { - swapl((int *) buffer); - buffer += 4; --- -2.33.1 - diff --git a/SOURCES/0004-xwayland-eglstream-Prefer-EGLstream-if-available.patch b/SOURCES/0004-xwayland-eglstream-Prefer-EGLstream-if-available.patch deleted file mode 100644 index a983979..0000000 --- a/SOURCES/0004-xwayland-eglstream-Prefer-EGLstream-if-available.patch +++ /dev/null @@ -1,64 +0,0 @@ -From bdc00ba749ac6cde35c025f5f6b1a5b49c1f4960 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 17 Nov 2021 09:56:52 +0100 -Subject: [PATCH xserver 4/4] xwayland/eglstream: Prefer EGLstream if available -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Currently, when given the choice, Xwayland will pick the GBM backend -over the EGLstream backend if both are available, unless the command -line option “-eglstream” is specified. - -The NVIDIA proprietary driver had no support for GBM until driver series -495, but starting with the driver series 495, both can be used. - -But there are other requirements with the rest of the stack, typically -Mesa, egl-wayland, libglvnd as documented in the NVIDIA driver. - -So if the NVIDIA driver series 495 gets installed, Xwayland will pick -the GBM backend even if EGLstream is available and may fail to render -properly. - -To avoid that issue, prefer EGLstream if EGLstream and all the Wayland -interfaces are available, and fallback to GBM automatically unless -“-eglstream” was specified. - -With this, the compositor, given the choice, can decide which actual -backend Xwayland would use by advertising (or not) the Wayland -"wl_eglstream_controller" interface. - -This change has no impact on compositors which do not have support for -EGLstream in the first place. - -Signed-off-by: Olivier Fourdan -Acked-by: Michel Dänzer -(cherry picked from commit 6dd9709bd85cf5de4067887818c864220b951355) ---- - hw/xwayland/xwayland-glamor.c | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c -index b34eafabb..f46b677f5 100644 ---- a/hw/xwayland/xwayland-glamor.c -+++ b/hw/xwayland/xwayland-glamor.c -@@ -441,14 +441,10 @@ xwl_glamor_select_eglstream_backend(struct xwl_screen *xwl_screen) - void - xwl_glamor_select_backend(struct xwl_screen *xwl_screen, Bool use_eglstream) - { -- if (use_eglstream) { -- if (!xwl_glamor_select_eglstream_backend(xwl_screen)) -+ if (!xwl_glamor_select_eglstream_backend(xwl_screen)) { -+ if (!use_eglstream) - xwl_glamor_select_gbm_backend(xwl_screen); - } -- else { -- if (!xwl_glamor_select_gbm_backend(xwl_screen)) -- xwl_glamor_select_eglstream_backend(xwl_screen); -- } - } - - Bool --- -2.33.1 - diff --git a/SOURCES/0005-Xext-free-the-screen-saver-resource-when-replacing-i.patch b/SOURCES/0005-Xext-free-the-screen-saver-resource-when-replacing-i.patch deleted file mode 100644 index bbf10bf..0000000 --- a/SOURCES/0005-Xext-free-the-screen-saver-resource-when-replacing-i.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 94f6fe99d87cf6ba0adadd95c595158c345b7d29 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 29 Nov 2022 14:53:07 +1000 -Subject: [PATCH xserver 5/7] Xext: free the screen saver resource when - replacing it - -This fixes a use-after-free bug: - -When a client first calls ScreenSaverSetAttributes(), a struct -ScreenSaverAttrRec is allocated and added to the client's -resources. - -When the same client calls ScreenSaverSetAttributes() again, a new -struct ScreenSaverAttrRec is allocated, replacing the old struct. The -old struct was freed but not removed from the clients resources. - -Later, when the client is destroyed the resource system invokes -ScreenSaverFreeAttr and attempts to clean up the already freed struct. - -Fix this by letting the resource system free the old attrs instead. - -CVE-2022-46343, ZDI-CAN 19404 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xext/saver.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Xext/saver.c b/Xext/saver.c -index f813ba08d1..fd6153c313 100644 ---- a/Xext/saver.c -+++ b/Xext/saver.c -@@ -1051,7 +1051,7 @@ ScreenSaverSetAttributes(ClientPtr client) - pVlist++; - } - if (pPriv->attr) -- FreeScreenAttr(pPriv->attr); -+ FreeResource(pPriv->attr->resource, AttrType); - pPriv->attr = pAttr; - pAttr->resource = FakeClientID(client->index); - if (!AddResource(pAttr->resource, AttrType, (void *) pAttr)) --- -2.38.1 diff --git a/SOURCES/0005-Xi-flush-hierarchy-events-after-adding-removing-mast.patch b/SOURCES/0005-Xi-flush-hierarchy-events-after-adding-removing-mast.patch deleted file mode 100644 index c760402..0000000 --- a/SOURCES/0005-Xi-flush-hierarchy-events-after-adding-removing-mast.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 7efd09cdb13ae1a4100f68a11947afe581fa1ee8 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 4 Jan 2024 10:01:24 +1000 -Subject: [PATCH xserver 5/9] Xi: flush hierarchy events after adding/removing - master devices - -The `XISendDeviceHierarchyEvent()` function allocates space to store up -to `MAXDEVICES` (256) `xXIHierarchyInfo` structures in `info`. - -If a device with a given ID was removed and a new device with the same -ID added both in the same operation, the single device ID will lead to -two info structures being written to `info`. - -Since this case can occur for every device ID at once, a total of two -times `MAXDEVICES` info structures might be written to the allocation. - -To avoid it, once one add/remove master is processed, send out the -device hierarchy event for the current state and continue. That event -thus only ever has exactly one of either added/removed in it (and -optionally slave attached/detached). - -CVE-2024-21885, ZDI-CAN-22744 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -(cherry picked from commit 4a5e9b1895627d40d26045bd0b7ef3dce503cbd1) ---- - Xi/xichangehierarchy.c | 27 ++++++++++++++++++++++----- - 1 file changed, 22 insertions(+), 5 deletions(-) - -diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c -index d2d985848..72d00451e 100644 ---- a/Xi/xichangehierarchy.c -+++ b/Xi/xichangehierarchy.c -@@ -416,6 +416,11 @@ ProcXIChangeHierarchy(ClientPtr client) - size_t len; /* length of data remaining in request */ - int rc = Success; - int flags[MAXDEVICES] = { 0 }; -+ enum { -+ NO_CHANGE, -+ FLUSH, -+ CHANGED, -+ } changes = NO_CHANGE; - - REQUEST(xXIChangeHierarchyReq); - REQUEST_AT_LEAST_SIZE(xXIChangeHierarchyReq); -@@ -465,8 +470,9 @@ ProcXIChangeHierarchy(ClientPtr client) - rc = add_master(client, c, flags); - if (rc != Success) - goto unwind; -- } -+ changes = FLUSH; - break; -+ } - case XIRemoveMaster: - { - xXIRemoveMasterInfo *r = (xXIRemoveMasterInfo *) any; -@@ -475,8 +481,9 @@ ProcXIChangeHierarchy(ClientPtr client) - rc = remove_master(client, r, flags); - if (rc != Success) - goto unwind; -- } -+ changes = FLUSH; - break; -+ } - case XIDetachSlave: - { - xXIDetachSlaveInfo *c = (xXIDetachSlaveInfo *) any; -@@ -485,8 +492,9 @@ ProcXIChangeHierarchy(ClientPtr client) - rc = detach_slave(client, c, flags); - if (rc != Success) - goto unwind; -- } -+ changes = CHANGED; - break; -+ } - case XIAttachSlave: - { - xXIAttachSlaveInfo *c = (xXIAttachSlaveInfo *) any; -@@ -495,16 +503,25 @@ ProcXIChangeHierarchy(ClientPtr client) - rc = attach_slave(client, c, flags); - if (rc != Success) - goto unwind; -+ changes = CHANGED; -+ break; - } -+ default: - break; - } - -+ if (changes == FLUSH) { -+ XISendDeviceHierarchyEvent(flags); -+ memset(flags, 0, sizeof(flags)); -+ changes = NO_CHANGE; -+ } -+ - len -= any->length * 4; - any = (xXIAnyHierarchyChangeInfo *) ((char *) any + any->length * 4); - } - - unwind: -- -- XISendDeviceHierarchyEvent(flags); -+ if (changes != NO_CHANGE) -+ XISendDeviceHierarchyEvent(flags); - return rc; - } --- -2.43.0 - diff --git a/SOURCES/0006-Xext-free-the-XvRTVideoNotify-when-turning-off-from-.patch b/SOURCES/0006-Xext-free-the-XvRTVideoNotify-when-turning-off-from-.patch deleted file mode 100644 index f9f1a10..0000000 --- a/SOURCES/0006-Xext-free-the-XvRTVideoNotify-when-turning-off-from-.patch +++ /dev/null @@ -1,73 +0,0 @@ -From a42635ee3c01f71a49052d83a372933504c9db04 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 30 Nov 2022 11:20:40 +1000 -Subject: [PATCH xserver 6/7] Xext: free the XvRTVideoNotify when turning off - from the same client - -This fixes a use-after-free bug: - -When a client first calls XvdiSelectVideoNotify() on a drawable with a -TRUE onoff argument, a struct XvVideoNotifyRec is allocated. This struct -is added twice to the resources: - - as the drawable's XvRTVideoNotifyList. This happens only once per - drawable, subsequent calls append to this list. - - as the client's XvRTVideoNotify. This happens for every client. - -The struct keeps the ClientPtr around once it has been added for a -client. The idea, presumably, is that if the client disconnects we can remove -all structs from the drawable's list that match the client (by resetting -the ClientPtr to NULL), but if the drawable is destroyed we can remove -and free the whole list. - -However, if the same client then calls XvdiSelectVideoNotify() on the -same drawable with a FALSE onoff argument, only the ClientPtr on the -existing struct was set to NULL. The struct itself remained in the -client's resources. - -If the drawable is now destroyed, the resource system invokes -XvdiDestroyVideoNotifyList which frees the whole list for this drawable -- including our struct. This function however does not free the resource -for the client since our ClientPtr is NULL. - -Later, when the client is destroyed and the resource system invokes -XvdiDestroyVideoNotify, we unconditionally set the ClientPtr to NULL. On -a struct that has been freed previously. This is generally frowned upon. - -Fix this by calling FreeResource() on the second call instead of merely -setting the ClientPtr to NULL. This removes the struct from the client -resources (but not from the list), ensuring that it won't be accessed -again when the client quits. - -Note that the assignment tpn->client = NULL; is superfluous since the -XvdiDestroyVideoNotify function will do this anyway. But it's left for -clarity and to match a similar invocation in XvdiSelectPortNotify. - -CVE-2022-46342, ZDI-CAN 19400 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - Xext/xvmain.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/Xext/xvmain.c b/Xext/xvmain.c -index f627471938..2a08f8744a 100644 ---- a/Xext/xvmain.c -+++ b/Xext/xvmain.c -@@ -811,8 +811,10 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff) - tpn = pn; - while (tpn) { - if (tpn->client == client) { -- if (!onoff) -+ if (!onoff) { - tpn->client = NULL; -+ FreeResource(tpn->id, XvRTVideoNotify); -+ } - return Success; - } - if (!tpn->client) --- -2.38.1 diff --git a/SOURCES/0006-Xi-do-not-keep-linked-list-pointer-during-recursion.patch b/SOURCES/0006-Xi-do-not-keep-linked-list-pointer-during-recursion.patch deleted file mode 100644 index 04ac195..0000000 --- a/SOURCES/0006-Xi-do-not-keep-linked-list-pointer-during-recursion.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 01cd3a72858ccc1afb0b42ace92263f2912619a3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= -Date: Fri, 22 Dec 2023 18:28:31 +0100 -Subject: [PATCH xserver 6/9] Xi: do not keep linked list pointer during - recursion - -The `DisableDevice()` function is called whenever an enabled device -is disabled and it moves the device from the `inputInfo.devices` linked -list to the `inputInfo.off_devices` linked list. - -However, its link/unlink operation has an issue during the recursive -call to `DisableDevice()` due to the `prev` pointer pointing to a -removed device. - -This issue leads to a length mismatch between the total number of -devices and the number of device in the list, leading to a heap -overflow and, possibly, to local privilege escalation. - -Simplify the code that checked whether the device passed to -`DisableDevice()` was in `inputInfo.devices` or not and find the -previous device after the recursion. - -CVE-2024-21886, ZDI-CAN-22840 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -(cherry picked from commit bc1fdbe46559dd947674375946bbef54dd0ce36b) ---- - dix/devices.c | 15 ++++++++++++--- - 1 file changed, 12 insertions(+), 3 deletions(-) - -diff --git a/dix/devices.c b/dix/devices.c -index 8fe4a341c..f3db37203 100644 ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -453,14 +453,20 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) - { - DeviceIntPtr *prev, other; - BOOL enabled; -+ BOOL dev_in_devices_list = FALSE; - int flags[MAXDEVICES] = { 0 }; - - if (!dev->enabled) - return TRUE; - -- for (prev = &inputInfo.devices; -- *prev && (*prev != dev); prev = &(*prev)->next); -- if (*prev != dev) -+ for (other = inputInfo.devices; other; other = other->next) { -+ if (other == dev) { -+ dev_in_devices_list = TRUE; -+ break; -+ } -+ } -+ -+ if (!dev_in_devices_list) - return FALSE; - - TouchEndPhysicallyActiveTouches(dev); -@@ -511,6 +517,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) - LeaveWindow(dev); - SetFocusOut(dev); - -+ for (prev = &inputInfo.devices; -+ *prev && (*prev != dev); prev = &(*prev)->next); -+ - *prev = dev->next; - dev->next = inputInfo.off_devices; - inputInfo.off_devices = dev; --- -2.43.0 - diff --git a/SOURCES/0007-dix-when-disabling-a-master-float-disabled-slaved-de.patch b/SOURCES/0007-dix-when-disabling-a-master-float-disabled-slaved-de.patch deleted file mode 100644 index 7db7dbd..0000000 --- a/SOURCES/0007-dix-when-disabling-a-master-float-disabled-slaved-de.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 42f8d1828b4fc1e0b8165a767a0b74edcdbf3806 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Fri, 5 Jan 2024 09:40:27 +1000 -Subject: [PATCH xserver 7/9] dix: when disabling a master, float disabled - slaved devices too - -Disabling a master device floats all slave devices but we didn't do this -to already-disabled slave devices. As a result those devices kept their -reference to the master device resulting in access to already freed -memory if the master device was removed before the corresponding slave -device. - -And to match this behavior, also forcibly reset that pointer during -CloseDownDevices(). - -Related to CVE-2024-21886, ZDI-CAN-22840 - -(cherry picked from commit 26769aa71fcbe0a8403b7fb13b7c9010cc07c3a8) ---- - dix/devices.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/dix/devices.c b/dix/devices.c -index f3db37203..95190b5b7 100644 ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -483,6 +483,13 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) - flags[other->id] |= XISlaveDetached; - } - } -+ -+ for (other = inputInfo.off_devices; other; other = other->next) { -+ if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev) { -+ AttachDevice(NULL, other, NULL); -+ flags[other->id] |= XISlaveDetached; -+ } -+ } - } - else { - for (other = inputInfo.devices; other; other = other->next) { -@@ -1080,6 +1087,11 @@ CloseDownDevices(void) - dev->master = NULL; - } - -+ for (dev = inputInfo.off_devices; dev; dev = dev->next) { -+ if (!IsMaster(dev) && !IsFloating(dev)) -+ dev->master = NULL; -+ } -+ - CloseDeviceList(&inputInfo.devices); - CloseDeviceList(&inputInfo.off_devices); - --- -2.43.0 - diff --git a/SOURCES/0007-xkb-reset-the-radio_groups-pointer-to-NULL-after-fre.patch b/SOURCES/0007-xkb-reset-the-radio_groups-pointer-to-NULL-after-fre.patch deleted file mode 100644 index 05de9ca..0000000 --- a/SOURCES/0007-xkb-reset-the-radio_groups-pointer-to-NULL-after-fre.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 774260dbae1fa505cd2848c786baed9a8db5179d Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Mon, 5 Dec 2022 15:55:54 +1000 -Subject: [PATCH xserver 7/7] xkb: reset the radio_groups pointer to NULL after - freeing it - -Unlike other elements of the keymap, this pointer was freed but not -reset. On a subsequent XkbGetKbdByName request, the server may access -already freed memory. - -CVE-2022-46283, ZDI-CAN-19530 - -This vulnerability was discovered by: -Jan-Niklas Sohn working with Trend Micro Zero Day Initiative - -Signed-off-by: Peter Hutterer -Acked-by: Olivier Fourdan ---- - xkb/xkbUtils.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c -index dd089c2046..3f5791a183 100644 ---- a/xkb/xkbUtils.c -+++ b/xkb/xkbUtils.c -@@ -1326,6 +1326,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) - } - else { - free(dst->names->radio_groups); -+ dst->names->radio_groups = NULL; - } - dst->names->num_rg = src->names->num_rg; - --- -2.38.1 diff --git a/SOURCES/0008-Xext-fix-invalid-event-type-mask-in-XTestSwapFakeInp.patch b/SOURCES/0008-Xext-fix-invalid-event-type-mask-in-XTestSwapFakeInp.patch deleted file mode 100644 index c84d387..0000000 --- a/SOURCES/0008-Xext-fix-invalid-event-type-mask-in-XTestSwapFakeInp.patch +++ /dev/null @@ -1,35 +0,0 @@ -From bb1711b7fba42f2a0c7d1c09beee241a1b2bcc30 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Mon, 19 Dec 2022 10:06:45 +1000 -Subject: [PATCH xserver] Xext: fix invalid event type mask in - XTestSwapFakeInput - -In commit b320ca0 the mask was inadvertently changed from octal 0177 to -hexadecimal 0x177. - -Fixes commit b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63 - Xtest: disallow GenericEvents in XTestSwapFakeInput - -Found by Stuart Cassoff - -Signed-off-by: Peter Hutterer ---- - Xext/xtest.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Xext/xtest.c b/Xext/xtest.c -index 2985a4ce6e..dde5c4cf9d 100644 ---- a/Xext/xtest.c -+++ b/Xext/xtest.c -@@ -502,7 +502,7 @@ XTestSwapFakeInput(ClientPtr client, xReq * req) - - nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent); - for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) { -- int evtype = ev->u.u.type & 0x177; -+ int evtype = ev->u.u.type & 0177; - /* Swap event */ - proc = EventSwapVector[evtype]; - /* no swapping proc; invalid event type? */ --- -2.38.1 - diff --git a/SOURCES/0008-glx-Call-XACE-hooks-on-the-GLX-buffer.patch b/SOURCES/0008-glx-Call-XACE-hooks-on-the-GLX-buffer.patch deleted file mode 100644 index 4071d27..0000000 --- a/SOURCES/0008-glx-Call-XACE-hooks-on-the-GLX-buffer.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 4093057b98bc5a178f130c9ba6b0b28385e24ae5 Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 6 Dec 2023 12:09:41 +0100 -Subject: [PATCH xserver 8/9] glx: Call XACE hooks on the GLX buffer - -The XSELINUX code will label resources at creation by checking the -access mode. When the access mode is DixCreateAccess, it will call the -function to label the new resource SELinuxLabelResource(). - -However, GLX buffers do not go through the XACE hooks when created, -hence leaving the resource actually unlabeled. - -When, later, the client tries to create another resource using that -drawable (like a GC for example), the XSELINUX code would try to use -the security ID of that object which has never been labeled, get a NULL -pointer and crash when checking whether the requested permissions are -granted for subject security ID. - -To avoid the issue, make sure to call the XACE hooks when creating the -GLX buffers. - -Credit goes to Donn Seeley for providing the patch. - -CVE-2024-0408 - -Signed-off-by: Olivier Fourdan -Acked-by: Peter Hutterer -(cherry picked from commit e5e8586a12a3ec915673edffa10dc8fe5e15dac3) ---- - glx/glxcmds.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/glx/glxcmds.c b/glx/glxcmds.c -index fc26a2e34..1e46d0c72 100644 ---- a/glx/glxcmds.c -+++ b/glx/glxcmds.c -@@ -48,6 +48,7 @@ - #include "indirect_util.h" - #include "protocol-versions.h" - #include "glxvndabi.h" -+#include "xace.h" - - static char GLXServerVendorName[] = "SGI"; - -@@ -1392,6 +1393,13 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, - if (!pPixmap) - return BadAlloc; - -+ err = XaceHook(XACE_RESOURCE_ACCESS, client, glxDrawableId, RT_PIXMAP, -+ pPixmap, RT_NONE, NULL, DixCreateAccess); -+ if (err != Success) { -+ (*pGlxScreen->pScreen->DestroyPixmap) (pPixmap); -+ return err; -+ } -+ - /* Assign the pixmap the same id as the pbuffer and add it as a - * resource so it and the DRI2 drawable will be reclaimed when the - * pbuffer is destroyed. */ --- -2.43.0 - diff --git a/SOURCES/0009-ephyr-xwayland-Use-the-proper-private-key-for-cursor.patch b/SOURCES/0009-ephyr-xwayland-Use-the-proper-private-key-for-cursor.patch deleted file mode 100644 index e69f70a..0000000 --- a/SOURCES/0009-ephyr-xwayland-Use-the-proper-private-key-for-cursor.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 51be9e767a02cdc6a524dc895dcc81abb689d50b Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Wed, 6 Dec 2023 11:51:56 +0100 -Subject: [PATCH xserver 9/9] ephyr,xwayland: Use the proper private key for - cursor - -The cursor in DIX is actually split in two parts, the cursor itself and -the cursor bits, each with their own devPrivates. - -The cursor itself includes the cursor bits, meaning that the cursor bits -devPrivates in within structure of the cursor. - -Both Xephyr and Xwayland were using the private key for the cursor bits -to store the data for the cursor, and when using XSELINUX which comes -with its own special devPrivates, the data stored in that cursor bits' -devPrivates would interfere with the XSELINUX devPrivates data and the -SELINUX security ID would point to some other unrelated data, causing a -crash in the XSELINUX code when trying to (re)use the security ID. - -CVE-2024-0409 - -Signed-off-by: Olivier Fourdan -Reviewed-by: Peter Hutterer -(cherry picked from commit 2ef0f1116c65d5cb06d7b6d83f8a1aea702c94f7) ---- - hw/xwayland/xwayland-cursor.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c -index e3c1aaa50..bd94b0cfb 100644 ---- a/hw/xwayland/xwayland-cursor.c -+++ b/hw/xwayland/xwayland-cursor.c -@@ -431,7 +431,7 @@ static miPointerScreenFuncRec xwl_pointer_screen_funcs = { - Bool - xwl_screen_init_cursor(struct xwl_screen *xwl_screen) - { -- if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR_BITS, 0)) -+ if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR, 0)) - return FALSE; - - return miPointerInitialize(xwl_screen->screen, --- -2.43.0 - diff --git a/SPECS/xorg-x11-server-Xwayland.spec b/SPECS/xorg-x11-server-Xwayland.spec deleted file mode 100644 index 784c0f7..0000000 --- a/SPECS/xorg-x11-server-Xwayland.spec +++ /dev/null @@ -1,273 +0,0 @@ -%global commit 280aac5a0ee09c45b17ec4be0681397f7c34c12e -%global shortcommit %(c=%{commit}; echo ${c:0:7}) - -#global gitdate 20210201 -%global pkgname %{?gitdate:xserver}%{!?gitdate:xwayland} - -%global default_font_path "catalogue:/etc/X11/fontpath.d,built-ins" - -Summary: Xwayland -Name: xorg-x11-server-Xwayland -Version: 21.1.3 -Release: 15%{?gitdate:.%{gitdate}git%{shortcommit}}%{?dist} - -URL: http://www.x.org -%if 0%{?gitdate} -Source0: https://gitlab.freedesktop.org/xorg/%{pkgname}/-/archive/%{commit}/%{pkgname}-%{shortcommit}.tar.gz -%else -Source0: https://www.x.org/pub/individual/xserver/%{pkgname}-%{version}.tar.xz -%endif - -Patch1: 0001-xwayland-eglstream-Demote-EGLstream-device-warning.patch -Patch2: 0002-xwayland-glamor-Change-errors-to-verbose-messages.patch -Patch3: 0003-xwayland-glamor-Log-backend-selected-for-debug.patch -Patch4: 0004-xwayland-eglstream-Prefer-EGLstream-if-available.patch -Patch5: 0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch - -# CVE-2021-4011 -Patch10001: 0001-record-Fix-out-of-bounds-access-in-SwapCreateRegiste.patch -# CVE-2021-4009 -Patch10002: 0002-xfixes-Fix-out-of-bounds-access-in-ProcXFixesCreateP.patch -# CVE-2021-4010 -Patch10003: 0003-Xext-Fix-out-of-bounds-access-in-SProcScreenSaverSus.patch -# CVE-2021-4008 -Patch10004: 0004-render-Fix-out-of-bounds-access-in-SProcRenderCompos.patch -# CVE-2022-2319/ZDI-CAN-16062, CVE-2022-2320/ZDI-CAN-16070 -Patch10005: 0001-xkb-switch-to-array-index-loops-to-moving-pointers.patch -Patch10006: 0002-xkb-swap-XkbSetDeviceInfo-and-XkbSetDeviceInfoCheck.patch -Patch10007: 0003-xkb-add-request-length-validation-for-XkbSetGeometry.patch -# CVE-2022-3550 -Patch10008: 0001-xkb-proof-GetCountedString-against-request-length-at.patch -# CVE-2022-3551 -Patch10009: 0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch -# CVE-2022-46340 -Patch10018: 0001-Xtest-disallow-GenericEvents-in-XTestSwapFakeInput.patch -# related to CVE-2022-46344 -Patch10019: 0002-Xi-return-an-error-from-XI-property-changes-if-verif.patch -# CVE-2022-46344 -Patch10020: 0003-Xi-avoid-integer-truncation-in-length-check-of-ProcX.patch -# CVE-2022-46341 -Patch10021: 0004-Xi-disallow-passive-grabs-with-a-detail-255.patch -# CVE-2022-46343 -Patch10022: 0005-Xext-free-the-screen-saver-resource-when-replacing-i.patch -# CVE-2022-46342 -Patch10023: 0006-Xext-free-the-XvRTVideoNotify-when-turning-off-from-.patch -# CVE-2022-4283 -Patch10024: 0007-xkb-reset-the-radio_groups-pointer-to-NULL-after-fre.patch -# Follow-up to CVE-2022-46340 -Patch10025: 0008-Xext-fix-invalid-event-type-mask-in-XTestSwapFakeInp.patch -# CVE-2023-0494 -Patch10026: 0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch -# CVE-2023-1393 -Patch10027: 0001-composite-Fix-use-after-free-of-the-COW.patch -# CVE-2023-5367 -Patch10028: 0001-Xi-randr-fix-handling-of-PropModeAppend-Prepend.patch -# CVE-2023-6478 -Patch10029: 0001-randr-avoid-integer-truncation-in-length-check-of-Pr.patch -# CVE-2023-6377 -Patch10030: 0001-Xi-allocate-enough-XkbActions-for-our-buttons.patch -# Fix for CVE-2023-6816, ZDI-CAN-22664, ZDI-CAN-22665 -Patch10031: 0001-dix-allocate-enough-space-for-logical-button-maps.patch -# Fix for CVE-2024-0229, ZDI-CAN-22678 -Patch10032: 0002-dix-Allocate-sufficient-xEvents-for-our-DeviceStateN.patch -Patch10033: 0003-dix-fix-DeviceStateNotify-event-calculation.patch -Patch10034: 0004-Xi-when-creating-a-new-ButtonClass-set-the-number-of.patch -# Fix for CVE-2024-21885, ZDI-CAN-22744 -Patch10035: 0005-Xi-flush-hierarchy-events-after-adding-removing-mast.patch -# Fix for CVE-2024-21886, ZDI-CAN-22840 -Patch10036: 0006-Xi-do-not-keep-linked-list-pointer-during-recursion.patch -Patch10037: 0007-dix-when-disabling-a-master-float-disabled-slaved-de.patch -# Fix for CVE-2024-0408 -Patch10038: 0008-glx-Call-XACE-hooks-on-the-GLX-buffer.patch -# Fix for CVE-2024-0409 -Patch10039: 0009-ephyr-xwayland-Use-the-proper-private-key-for-cursor.patch - -License: MIT - -Requires: xorg-x11-server-common -Requires: libEGL -Requires: libepoxy >= 1.5.5 - -BuildRequires: gcc -BuildRequires: git-core -BuildRequires: meson - -BuildRequires: wayland-devel -BuildRequires: pkgconfig(wayland-client) >= 1.3.0 -BuildRequires: pkgconfig(wayland-protocols) -BuildRequires: pkgconfig(wayland-eglstream-protocols) - -BuildRequires: pkgconfig(dmx) -BuildRequires: pkgconfig(epoxy) >= 1.5.5 -BuildRequires: pkgconfig(fontenc) -BuildRequires: pkgconfig(libdrm) >= 2.4.0 -BuildRequires: pkgconfig(libssl) -BuildRequires: pkgconfig(libtirpc) -BuildRequires: pkgconfig(pixman-1) -BuildRequires: pkgconfig(x11) -BuildRequires: pkgconfig(xau) -BuildRequires: pkgconfig(xdmcp) -BuildRequires: pkgconfig(xext) -BuildRequires: pkgconfig(xfixes) -BuildRequires: pkgconfig(xfont2) -BuildRequires: pkgconfig(xi) -BuildRequires: pkgconfig(xinerama) -BuildRequires: pkgconfig(xkbfile) -BuildRequires: pkgconfig(xmu) -BuildRequires: pkgconfig(xorg-macros) >= 1.17 -BuildRequires: pkgconfig(xpm) -BuildRequires: pkgconfig(xrender) -BuildRequires: pkgconfig(xres) -BuildRequires: pkgconfig(xshmfence) >= 1.1 -BuildRequires: pkgconfig(xtrans) >= 1.3.2 -BuildRequires: pkgconfig(xtst) -BuildRequires: pkgconfig(xv) -BuildRequires: xorg-x11-proto-devel >= 7.7-10 - -BuildRequires: mesa-libGL-devel >= 9.2 -BuildRequires: mesa-libEGL-devel -BuildRequires: mesa-libgbm-devel - -BuildRequires: audit-libs-devel -BuildRequires: libselinux-devel >= 2.0.86-1 - -# libunwind is Exclusive for the following arches -%ifarch aarch64 %{arm} hppa ia64 mips ppc ppc64 %{ix86} x86_64 -%if !0%{?rhel} -BuildRequires: libunwind-devel -%endif -%endif - -BuildRequires: pkgconfig(xcb-aux) -BuildRequires: pkgconfig(xcb-image) -BuildRequires: pkgconfig(xcb-icccm) -BuildRequires: pkgconfig(xcb-keysyms) -BuildRequires: pkgconfig(xcb-renderutil) - -%description -Xwayland is an X server for running X clients under Wayland. - -%package devel -Summary: Development package -Requires: pkgconfig - -%description devel -The development package provides the developmental files which are -necessary for developing Wayland compositors using Xwayland. - -%prep -%autosetup -S git_am -n %{pkgname}-%{?gitdate:%{commit}}%{!?gitdate:%{version}} - -%build -%meson \ - -Dxwayland_eglstream=true \ - -Ddefault_font_path=%{default_font_path} \ - -Dbuilder_string="Build ID: %{name} %{version}-%{release}" \ - -Dxkb_output_dir=%{_localstatedir}/lib/xkb \ - -Dxcsecurity=true \ - -Dglamor=true \ - -Ddri3=true - -%meson_build - -%install -%meson_install - -# Remove unwanted files/dirs -rm $RPM_BUILD_ROOT%{_mandir}/man1/Xserver.1* -rm -Rf $RPM_BUILD_ROOT%{_libdir}/xorg -rm -Rf $RPM_BUILD_ROOT%{_includedir}/xorg -rm -Rf $RPM_BUILD_ROOT%{_datadir}/aclocal -rm -Rf $RPM_BUILD_ROOT%{_localstatedir}/lib/xkb - -%files -%{_bindir}/Xwayland -%{_mandir}/man1/Xwayland.1* - -%files devel -%{_libdir}/pkgconfig/xwayland.pc - -%changelog -* Tue Jan 16 2024 Olivier Fourdan - 21.1.3-15 - Fix for CVE-2023-6816, CVE-2024-0229, CVE-2024-21885, CVE-2024-21886, - CVE-2024-0408, CVE-2024-0409 - -* Wed Dec 13 2023 Olivier Fourdan - 21.1.3-14 -- Fix for CVE-2023-6377, CVE-2023-6478 - -* Wed Oct 25 2023 Olivier Fourdan - 21.1.3-13 -- Fix for CVE-2023-5367 - -* Tue Jun 13 2023 Olivier Fourdan - 21.1.3-12 -- Backport fix for a deadlock with DRI3 - Resolves: rhbz#2212831 - -* Fri Mar 31 2023 Olivier Fourdan - 21.1.3-11 -- Fix CVE-2023-1393 (#2180298) - -* Tue Feb 7 2023 Olivier Fourdan - 21.1.3-10 -- Fix CVE-2023-0494 (#2166972) - -* Mon Dec 19 2022 Peter Hutterer - 21.1.3-9 -- Follow-up fix for CVE-2022-46340 (#2151777) - -* Tue Dec 13 2022 Peter Hutterer - 21.1.3-8 -- CVE fix for: CVE-2022-4283 (#2151802), CVE-2022-46340 (#2151777), - CVE-2022-46341 (#2151782), CVE-2022-46342 (#2151785), - CVE-2022-46343 (#2151792), CVE-2022-46344 (#2151795) - -* Mon Nov 14 2022 Olivier Fourdan - 21.1.3-7 -- Fix CVE-2022-3550, CVE-2022-3551 - Resolves: rhbz#2140767, rhbz#2140774 - -* Fri Jul 29 2022 Olivier Fourdan - 21.1.3-6 -- CVE fix for: CVE-2022-2319/ZDI-CAN-16062, CVE-2022-2320/ZDI-CAN-16070 - Resolves: rhbz#2110442, rhbz#2110437 - -* Thu Jun 09 2022 Ray Strode - 21.1.3-5 -- Rebuild again for ipv6 xtrans fix - Related: #2075132 - -* Tue May 24 2022 Ray Strode - 21.1.3-3 -- Rebuild for ipv6 xtrans fix - Related: #2075132 - -* Fri Jan 7 2022 Olivier Fourdan - 21.1.3-2 -- CVE fix for: CVE-2021-4008 (#2038066), CVE-2021-4009 (#2038068), - CVE-2021-4010 (#2038071), CVE-2021-4011 (#2038073) - -* Thu Dec 2 2021 Olivier Fourdan - 21.1.3-1 -- Rebase to 21.1.3 (rhbz#2015842) -- Prefer EGLstream if both EGLstream and GBM are usable - -* Mon Aug 9 2021 Olivier Fourdan - 21.1.1-6 -- Backport the latest fixes from Xwayland for EGLstream (rhbz#1977741) - -* Tue Jun 29 2021 Olivier Fourdan - 21.1.1-5 -- Require libepoxy >= 1.5.5 (rhbz#1976132) - -* Mon Jun 21 2021 Olivier Fourdan - 21.1.1-4 -- Fix a use-after-free in the previous changes for GLX - -* Mon Jun 14 2021 Olivier Fourdan - 21.1.1-3 -- Backport fixes for GLX and EGLstream (#1961981) - -* Thu Jun 03 2021 Tomas Pelka - 21.1.1-2 -- bump release and rebuild to correctly trigger gating - -* Wed Apr 14 2021 Olivier Fourdan - 21.1.1-1 -- xwayland 21.1.1 (CVE-2021-3472 / ZDI-CAN-1259) - -* Thu Mar 18 2021 Olivier Fourdan - 21.1.0-1 -- xwayland 21.1.0 - -* Thu Mar 4 2021 Olivier Fourdan - 21.0.99.902-1 -- xwayland 21.0.99.902 -- Remove xdmcp, udev, udev_kms build options -- Stop overriding the vendor name, same as xorg-x11-server - -* Thu Feb 18 2021 Olivier Fourdan - 21.0.99.901-1 -- xwayland 21.0.99.901 - -* Mon Feb 1 2021 Olivier Fourdan - 1.20.99.1-0.1.20210201git5429791 -- Initial import (#1912335). diff --git a/sources b/sources new file mode 100644 index 0000000..34e7bfa --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (xwayland-24.1.5.tar.xz) = 4c821e62013c2c79edff364c3c5e34c58f9b0e0c411baba23d9ebe3fe1daf8bbb99e56b6041c5cba66a219d9f80c469a5ee1238cef728eda197f19e7bba1e74a diff --git a/xorg-x11-server-Xwayland.spec b/xorg-x11-server-Xwayland.spec new file mode 100644 index 0000000..40b269d --- /dev/null +++ b/xorg-x11-server-Xwayland.spec @@ -0,0 +1,350 @@ +%global commit 9a55c402aa803fb10e39ab4fd18a709d0cd06fd4 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +#global gitdate 20230426 +%global pkgname %{?gitdate:xserver}%{!?gitdate:xwayland} + +%global default_font_path "catalogue:/etc/X11/fontpath.d,built-ins" + +Summary: Xwayland +Name: xorg-x11-server-Xwayland +Version: 24.1.5 +Release: 2%{?gitdate:.%{gitdate}git%{shortcommit}}%{?dist} + +URL: http://www.x.org +%if 0%{?gitdate} +Source0: https://gitlab.freedesktop.org/xorg/%{pkgname}/-/archive/%{commit}/%{pkgname}-%{shortcommit}.tar.gz +%else +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 + +License: MIT + +Requires: xkeyboard-config +Requires: xkbcomp +Requires: libEGL +Requires: libepoxy >= 1.5.5 + +BuildRequires: gcc +BuildRequires: git-core +BuildRequires: meson + +BuildRequires: wayland-devel +BuildRequires: desktop-file-utils + +BuildRequires: pkgconfig(wayland-client) >= 1.21.0 +BuildRequires: pkgconfig(wayland-protocols) >= 1.34 + +BuildRequires: pkgconfig(epoxy) >= 1.5.5 +BuildRequires: pkgconfig(fontenc) +BuildRequires: pkgconfig(libdrm) >= 2.4.89 +BuildRequires: pkgconfig(libssl) +BuildRequires: pkgconfig(libtirpc) +BuildRequires: pkgconfig(pixman-1) +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(xau) +BuildRequires: pkgconfig(xdmcp) +BuildRequires: pkgconfig(xext) +BuildRequires: pkgconfig(xfixes) +BuildRequires: pkgconfig(xfont2) +BuildRequires: pkgconfig(xi) +BuildRequires: pkgconfig(xinerama) +BuildRequires: pkgconfig(xkbfile) +BuildRequires: pkgconfig(xmu) +BuildRequires: pkgconfig(xrender) +BuildRequires: pkgconfig(xres) +BuildRequires: pkgconfig(xshmfence) >= 1.1 +BuildRequires: pkgconfig(xtrans) >= 1.3.2 +BuildRequires: pkgconfig(xtst) +BuildRequires: pkgconfig(xv) +BuildRequires: pkgconfig(libxcvt) +BuildRequires: pkgconfig(libdecor-0) >= 0.1.1 +BuildRequires: pkgconfig(liboeffis-1.0) >= 1.0.0 +BuildRequires: pkgconfig(libei-1.0) >= 1.0.0 +BuildRequires: xorg-x11-proto-devel >= 2024.1-1 + +BuildRequires: mesa-libGL-devel >= 9.2 +BuildRequires: mesa-libEGL-devel +BuildRequires: mesa-libgbm-devel + +BuildRequires: audit-libs-devel +BuildRequires: libselinux-devel >= 2.0.86-1 + +# libunwind is Exclusive for the following arches +%ifarch aarch64 %{arm} hppa ia64 mips ppc ppc64 %{ix86} x86_64 +%if !0%{?rhel} +BuildRequires: libunwind-devel +%endif +%endif + +BuildRequires: pkgconfig(xcb-aux) +BuildRequires: pkgconfig(xcb-image) +BuildRequires: pkgconfig(xcb-icccm) +BuildRequires: pkgconfig(xcb-keysyms) +BuildRequires: pkgconfig(xcb-renderutil) + +%description +Xwayland is an X server for running X clients under Wayland. + +%package devel +Summary: Development package +Requires: pkgconfig +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The development package provides the developmental files which are +necessary for developing Wayland compositors using Xwayland. + +%prep +%autosetup -S git_am -n %{pkgname}-%{?gitdate:%{commit}}%{!?gitdate:%{version}} + +%build +%meson \ + %{?gitdate:-Dxwayland=true -D{xorg,xnest,xvfb,udev}=false} \ + -Ddefault_font_path=%{default_font_path} \ + -Dbuilder_string="Build ID: %{name} %{version}-%{release}" \ + -Dxkb_output_dir=%{_localstatedir}/lib/xkb \ + -Dserverconfigdir=%{_datadir}/xwayland \ + -Dxcsecurity=true \ + -Dglamor=true \ + -Ddri3=true + +%meson_build + +%install +%meson_install + +# Remove unwanted files/dirs +rm $RPM_BUILD_ROOT%{_mandir}/man1/Xserver.1* +rm -Rf $RPM_BUILD_ROOT%{_includedir}/xorg +rm -Rf $RPM_BUILD_ROOT%{_datadir}/aclocal + +%check +desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop + +%files +%dir %{_datadir}/xwayland +%{_bindir}/Xwayland +%{_mandir}/man1/Xwayland.1* +%{_datadir}/applications/org.freedesktop.Xwayland.desktop +%{_datadir}/xwayland/protocol.txt + +%files devel +%{_libdir}/pkgconfig/xwayland.pc + +%changelog +* Wed Feb 26 2025 Olivier Fourdan - 24.1.5-2 +- CVE fix for: CVE-2025-26594 (RHEL-80504), CVE-2025-26595 (RHEL-80505), + CVE-2025-26596 (RHEL-80510), CVE-2025-26597 (RHEL-80511), + CVE-2025-26598 (RHEL-80513), CVE-2025-26599 (RHEL-80512), + CVE-2025-26600 (RHEL-80517), CVE-2025-26601 (RHEL-80516) + +* Tue Feb 11 2025 Olivier Fourdan - 24.1.5-1 +- xwayland 24.1.5 (RHEL-78562) +- Fix a regression with keyboard modifiers due to a bug in gamescope + +* Thu Nov 7 2024 Olivier Fourdan - 24.1.1-4 +- Remove unneeded build dependencies on xorg-x11-util-macros and libXpm +- Remove unneeded build dependency on wayland-eglstream-protocols (RHEL-66317) + +* Wed Oct 30 2024 Olivier Fourdan - 24.1.1-3 +- Fix for CVE-2024-9632 - (RHEL-61994) + +* Tue Oct 29 2024 Troy Dawson - 24.1.1-2 +- Bump release for October 2024 mass rebuild: + Resolves: RHEL-64018 + +* Wed Jul 10 2024 Olivier Fourdan - 24.1.1-1 +- xwayland 24.1.1 (RHEL-45260) + +* Mon Jun 24 2024 Troy Dawson - 24.1.0-2 +- Bump release for June 2024 mass rebuild + +* Wed May 15 2024 Olivier Fourdan - 24.1.0-1 +- xwayland 24.1.0 (RHEL-29911) + +* Thu Apr 4 2024 Olivier Fourdan - 23.2.4-4 +- CVE fix for: CVE-2024-31080, CVE-2024-31081, CVE-2024-31083 + +* Mon Jan 29 2024 Florian Weimer - 23.2.4-3 +- Fix C compatibility issue on i686 + +* Sat Jan 27 2024 Fedora Release Engineering - 23.2.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Tue Jan 16 2024 Olivier Fourdan - 23.2.4-1 +- xwayland 23.2.4 - (#2254280) + CVE fix for: CVE-2023-6816, CVE-2024-0229, CVE-2024-21885, CVE-2024-21886, + CVE-2024-0408, CVE-2024-0409 + +* Wed Dec 13 2023 Peter Hutterer - 23.2.3-1 +- xwayland 23.2.3 + CVE fix for: CVE-2023-6377, CVE-2023-6478 + +* Fri Nov 24 2023 Olivier Fourdan - 23.2.2-2 +- Drop dependency on xorg-x11-server-common + +* Thu Oct 26 2023 Olivier Fourdan - 23.2.2-1 +- xwayland 23.2.2 - (#2246029) + +* Wed Oct 25 2023 Peter Hutterer - 23.2.1-2 +- Fix for CVE-2023-5367 + +* Wed Sep 20 2023 Olivier Fourdan - 23.2.1-1 +- xwayland 23.2.1 - (#2239813) + +* Mon Sep 11 2023 Olivier Fourdan - 23.2.0-2 +- migrated to SPDX license + +* Wed Aug 16 2023 Olivier Fourdan - 23.2.0-1 +- xwayland 23.2.0 + +* Wed Aug 2 2023 Olivier Fourdan - 23.1.99.902-1 +- xwayland 23.1.99.902 (xwayland 23.2.0 rc2) + +* Mon Jul 31 2023 Olivier Fourdan - 23.1.99.901-2 +- Fix devel package requires. + +* Wed Jul 19 2023 Olivier Fourdan - 23.1.99.901-1 +- xwayland 23.1.99.901 (xwayland 23.2.0 rc1) + +* Tue Jun 6 2023 Olivier Fourdan - 23.1.2-1 +- xwayland 23.1.2 + +* Thu Apr 27 2023 Olivier Fourdan - 23.1.1-2 +- Fix spec file to build from git upstream - (#2190211) + +* Wed Mar 29 2023 Olivier Fourdan - 23.1.1-1 +- xwayland 23.1.1 - (#2182734) + CVE fix for: CVE-2023-1393 + +* Wed Mar 22 2023 Olivier Fourdan - 23.1.0-1 +- xwayland 23.1.0 - (#2180913) + +* Thu Mar 9 2023 Olivier Fourdan - 23.0.99.902-1 +- xwayland 23.0.99.902 (xwayland 23.1.0 rc2) - (#2172415, #2173201) + +* Wed Feb 22 2023 Olivier Fourdan - 23.0.99.901-1 +- xwayland 23.0.99.901 (xwayland 23.1.0 rc1) - (#2172415) + +* Tue Feb 7 2023 Olivier Fourdan - 22.1.8-1 +- xwayland 22.1.8 + Fixes CVE-2023-0494 (#2165995, #2167566, #2167734) + +* Sun Jan 29 2023 Stefan Bluhm - 22.1.7-4 +- Updated conditional Fedora statement. + +* Thu Jan 19 2023 Olivier Fourdan - 22.1.7-3 +- Use the recommended way to apply conditional patches without + conditionalizing the sources (for byte-swapped clients). + +* Tue Jan 17 2023 Olivier Fourdan - 22.1.7-2 +- Disallow byte-swapped clients on Fedora 38 and above (#2159489) + +* Mon Dec 19 2022 Olivier Fourdan - 22.1.7-1 +- xwayland 22.1.7 + +* Wed Dec 14 2022 Peter Hutterer - 22.1.6-1 +- xwayland 22.1.6 + Fixes CVE-2022-46340, CVE-2022-46341, CVE-2022-46342, CVE-2022-46343, + CVE-2022-46344, CVE-2022-4283 + +* Wed Nov 2 2022 Olivier Fourdan - 22.1.5-1 +- xwayland 22.1.5 (#2139387) + +* Thu Oct 20 2022 Olivier Fourdan - 22.1.4-1 +- xwayland 22.1.4 (#2136518) + +* Sat Jul 23 2022 Fedora Release Engineering - 22.1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Tue Jul 12 2022 Olivier Fourdan - 22.1.3-1 +- xwayland 22.1.3 - (#2106387) + Fix CVE-2022-2319/ZDI-CAN-16062, CVE-2022-2320/ZDI-CAN-16070 + +* Wed May 25 2022 Olivier Fourdan - 22.1.2-1 +- xwayland 22.1.2 - (#2090172) + +* Thu Mar 31 2022 Olivier Fourdan - 22.1.1-1 +- xwayland 22.1.1 - (#2070435) + +* Wed Feb 16 2022 Olivier Fourdan - 22.1.0 +- xwayland 22.1.0 - (#2055270) + +* Wed Feb 2 2022 Olivier Fourdan - 22.0.99.902 +- xwayland 22.0.99.902 (xwayland 22.1.0 rc2) - (#2042521) + +* Tue Jan 25 2022 Olivier Fourdan - 22.0.99.901 +- xwayland 22.0.99.901 (xwayland 22.1.0 rc1) - (#2042521) + +* Sat Jan 22 2022 Fedora Release Engineering - 21.1.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Tue Dec 14 2021 Olivier Fourdan - 21.1.4 +- xwayland 21.1.4 + +* Mon Nov 8 2021 Olivier Fourdan - 21.1.3 +- xwayland 21.1.3 - (#2016468) + +* Thu Oct 21 2021 Olivier Fourdan - 21.1.2.901-1 +- xwayland 21.1.2.901 (aka 21.1.3 RC1) - (#2015413) + +* Tue Sep 14 2021 Sahana Prasad - 21.1.2-3 +- Rebuilt with OpenSSL 3.0.0 + +* Fri Jul 23 2021 Fedora Release Engineering - 21.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jul 9 2021 Olivier Fourdan - 21.1.2-1 +- xwayland 21.1.2 + +* Thu Jul 1 2021 Olivier Fourdan - 21.1.1.901-1 +- xwayland 21.1.1.901 + +* Mon Jun 21 2021 Olivier Fourdan - 21.1.1-3 +- Fix a use-after-free in the previous changes for GLX + +* Thu Jun 10 2021 Olivier Fourdan - 21.1.1-2 +- Backport fixes for GLX and EGLstream (#1948003) + +* Wed Apr 14 2021 Olivier Fourdan - 21.1.1-1 +- xwayland 21.1.1 (CVE-2021-3472 / ZDI-CAN-1259) + +* Thu Mar 18 2021 Olivier Fourdan - 21.1.0-1 +- xwayland 21.1.0 + +* Thu Mar 4 2021 Olivier Fourdan - 21.0.99.902-1 +- xwayland 21.0.99.902 +- Remove xdmcp, udev, udev_kms build options +- Stop overriding the vendor name, same as xorg-x11-server + +* Thu Feb 18 2021 Olivier Fourdan - 21.0.99.901-1 +- xwayland 21.0.99.901 + +* Mon Feb 1 2021 Olivier Fourdan - 1.20.99.1-0.1.20210201git5429791 +- Initial import (#1912335).