diff -u xorg-server-21.1.3/debian/changelog xorg-server-21.1.3/debian/changelog --- xorg-server-21.1.3/debian/changelog +++ xorg-server-21.1.3/debian/changelog @@ -1,3 +1,44 @@ +xorg-server (2:21.1.3-2ubuntu2.5) jammy-security; urgency=medium + + * SECURITY UPDATE: XTestSwapFakeInput stack overflow + - debian/patches/CVE-2022-46340.patch: disallow GenericEvents in + XTestSwapFakeInput in Xext/xtest.c. + - CVE-2022-46340 + * SECURITY UPDATE: XIPassiveUngrabDevice out-of-bounds access + - debian/patches/CVE-2022-46341.patch: disallow passive grabs with a + detail > 255 in Xi/xipassivegrab.c. + - CVE-2022-46341 + * SECURITY UPDATE: XvdiSelectVideoNotify use-after-free + - debian/patches/CVE-2022-46342.patch: free the XvRTVideoNotify when + turning off from the same client in Xext/xvmain.c. + - CVE-2022-46342 + * SECURITY UPDATE: ScreenSaverSetAttributes use-after-free + - debian/patches/CVE-2022-46343.patch: free the screen saver resource + when replacing it in Xext/saver.c. + - CVE-2022-46343 + * SECURITY UPDATE: XIChangeProperty out-of-bounds access + - debian/patches/CVE-2022-46344-1.patch: return an error from XI + property changes if verification failed in Xi/xiproperty.c. + - debian/patches/CVE-2022-46344-2.patch: avoid integer truncation in + length check of ProcXIChangeProperty in Xi/xiproperty.c. + - CVE-2022-46344 + * SECURITY UPDATE: XkbGetKbdByName use-after-free + - debian/patches/CVE-2022-4283.patch: reset the radio_groups pointer to + NULL after freeing it in xkb/xkbUtils.c. + - CVE-2022-4283 + + -- Marc Deslauriers Wed, 07 Dec 2022 07:56:57 -0500 + +xorg-server (2:21.1.3-2ubuntu2.4) jammy; urgency=medium + + * patches: Remove some merge cruft. + * re-calculate-the-clock-and-refresh-rate.diff: Fix modes on 2.5k@90Hz + panels. (LP: #1996490) + * patches: Don't send touch end to clients that do async grab without + touches. (LP: #1994027) + + -- Timo Aaltonen Thu, 24 Nov 2022 14:21:14 +0200 + xorg-server (2:21.1.3-2ubuntu2.3) jammy-security; urgency=medium * SECURITY UPDATE: GetCountedString Buffer Overflow diff -u xorg-server-21.1.3/debian/patches/series xorg-server-21.1.3/debian/patches/series --- xorg-server-21.1.3/debian/patches/series +++ xorg-server-21.1.3/debian/patches/series @@ -32,0 +33,9 @@ +re-calculate-the-clock-and-refresh-rate.diff +dix-Don-t-send-touch-end-to-clients-that-do-async-gr.patch +CVE-2022-46340.patch +CVE-2022-46341.patch +CVE-2022-46342.patch +CVE-2022-46343.patch +CVE-2022-46344-1.patch +CVE-2022-46344-2.patch +CVE-2022-4283.patch reverted: --- xorg-server-21.1.3/debian/patches/series_BACKUP_2065482 +++ xorg-server-21.1.3.orig/debian/patches/series_BACKUP_2065482 @@ -1,30 +0,0 @@ -## Patches with a number < 100 are applied in debian. -## Ubuntu patches start with 100. -001_fedora_extramodes.patch -02_kbsd-input-devd.diff -03_static-nettle.diff -05_Revert-Unload-submodules.diff -06_use-intel-only-on-pre-gen4.diff -07_use-modesetting-driver-by-default-on-GeForce.diff -<<<<<<< HEAD - -## Ubuntu patches, not upstreamable -168_glibc_trace_to_stderr.patch -226_fall_back_to_autoconfiguration.patch -300-mi-sprite-SaveUnderCursor2.patch - -## send upstream -xfree86-no-xv-for-gpuscreens.patch -no-nv.patch - -## upstream patches - -# hybrid graphics fixes -xf86-ignore-conflicting-rr-caps.patch - -xi2-resize-touch.patch -fix-default-permissions.patch -reset-transforms-in-closescreen.diff -======= -present-Check-for-NULL-to-prevent-crash.patch ->>>>>>> debian-unstable reverted: --- xorg-server-21.1.3/debian/patches/series_BASE_2065482 +++ xorg-server-21.1.3.orig/debian/patches/series_BASE_2065482 @@ -1,8 +0,0 @@ -## Patches with a number < 100 are applied in debian. -## Ubuntu patches start with 100. -001_fedora_extramodes.patch -02_kbsd-input-devd.diff -03_static-nettle.diff -05_Revert-Unload-submodules.diff -06_use-intel-only-on-pre-gen4.diff -07_use-modesetting-driver-by-default-on-GeForce.diff reverted: --- xorg-server-21.1.3/debian/patches/series_LOCAL_2065482 +++ xorg-server-21.1.3.orig/debian/patches/series_LOCAL_2065482 @@ -1,26 +0,0 @@ -## Patches with a number < 100 are applied in debian. -## Ubuntu patches start with 100. -001_fedora_extramodes.patch -02_kbsd-input-devd.diff -03_static-nettle.diff -05_Revert-Unload-submodules.diff -06_use-intel-only-on-pre-gen4.diff -07_use-modesetting-driver-by-default-on-GeForce.diff - -## Ubuntu patches, not upstreamable -168_glibc_trace_to_stderr.patch -226_fall_back_to_autoconfiguration.patch -300-mi-sprite-SaveUnderCursor2.patch - -## send upstream -xfree86-no-xv-for-gpuscreens.patch -no-nv.patch - -## upstream patches - -# hybrid graphics fixes -xf86-ignore-conflicting-rr-caps.patch - -xi2-resize-touch.patch -fix-default-permissions.patch -reset-transforms-in-closescreen.diff reverted: --- xorg-server-21.1.3/debian/patches/series_REMOTE_2065482 +++ xorg-server-21.1.3.orig/debian/patches/series_REMOTE_2065482 @@ -1,9 +0,0 @@ -## Patches with a number < 100 are applied in debian. -## Ubuntu patches start with 100. -001_fedora_extramodes.patch -02_kbsd-input-devd.diff -03_static-nettle.diff -05_Revert-Unload-submodules.diff -06_use-intel-only-on-pre-gen4.diff -07_use-modesetting-driver-by-default-on-GeForce.diff -present-Check-for-NULL-to-prevent-crash.patch only in patch2: unchanged: --- xorg-server-21.1.3.orig/debian/patches/CVE-2022-4283.patch +++ xorg-server-21.1.3/debian/patches/CVE-2022-4283.patch @@ -0,0 +1,30 @@ +From 79916ec4eed724b481d24d97686d3ed05a939859 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Mon, 5 Dec 2022 15:55:54 +1000 +Subject: [PATCH xserver] 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. + +ZDI-CAN-19530 + +This vulnerability was discovered by: +Jan-Niklas Sohn working with Trend Micro Zero Day Initiative + +Signed-off-by: Peter Hutterer +--- + xkb/xkbUtils.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/xkb/xkbUtils.c ++++ b/xkb/xkbUtils.c +@@ -1327,6 +1327,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr + } + else { + free(dst->names->radio_groups); ++ dst->names->radio_groups = NULL; + } + dst->names->num_rg = src->names->num_rg; + only in patch2: unchanged: --- xorg-server-21.1.3.orig/debian/patches/CVE-2022-46340.patch +++ xorg-server-21.1.3/debian/patches/CVE-2022-46340.patch @@ -0,0 +1,51 @@ +From 2e8916efe9a8566f97a4c2231891ad0f555fced1 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 29 Nov 2022 12:55:45 +1000 +Subject: [PATCH xserver 1/6] 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. + +ZDI-CAN 19265 + +This vulnerability was discovered by: +Jan-Niklas Sohn working with Trend Micro Zero Day Initiative + +Signed-off-by: Peter Hutterer +--- + 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 + only in patch2: unchanged: --- xorg-server-21.1.3.orig/debian/patches/CVE-2022-46341.patch +++ xorg-server-21.1.3/debian/patches/CVE-2022-46341.patch @@ -0,0 +1,81 @@ +From 9dc018a5a1a183e0a2cb945572454779b499430c Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 29 Nov 2022 13:55:32 +1000 +Subject: [PATCH xserver 4/6] 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. + +ZDI-CAN 19381 + +This vulnerability was discovered by: +Jan-Niklas Sohn working with Trend Micro Zero Day Initiative + +Signed-off-by: Peter Hutterer +--- + Xi/xipassivegrab.c | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c +index 2769fb7c94..c9ac2f8553 100644 +--- a/Xi/xipassivegrab.c ++++ b/Xi/xipassivegrab.c +@@ -137,6 +137,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; +@@ -207,14 +213,8 @@ ProcXIPassiveGrabDevice(ClientPtr client) + ¶m, XI2, &mask); + break; + case XIGrabtypeKeycode: +- /* 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 */ +- if (stuff->detail > 255) +- status = XIAlreadyGrabbed; +- else +- status = GrabKey(client, dev, mod_dev, stuff->detail, +- ¶m, XI2, &mask); ++ status = GrabKey(client, dev, mod_dev, stuff->detail, ++ ¶m, XI2, &mask); + break; + case XIGrabtypeEnter: + case XIGrabtypeFocusIn: +@@ -334,6 +334,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 + only in patch2: unchanged: --- xorg-server-21.1.3.orig/debian/patches/CVE-2022-46342.patch +++ xorg-server-21.1.3/debian/patches/CVE-2022-46342.patch @@ -0,0 +1,73 @@ +From 4ca304326d3b222a446aca82ec3c28ee8adf8446 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Wed, 30 Nov 2022 11:20:40 +1000 +Subject: [PATCH xserver 6/6] 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. + +ZDI-CAN 19400 + +This vulnerability was discovered by: +Jan-Niklas Sohn working with Trend Micro Zero Day Initiative + +Signed-off-by: Peter Hutterer +--- + 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 + only in patch2: unchanged: --- xorg-server-21.1.3.orig/debian/patches/CVE-2022-46343.patch +++ xorg-server-21.1.3/debian/patches/CVE-2022-46343.patch @@ -0,0 +1,47 @@ +From 06eb55528bb62f7418f740152642f2066d593bbf Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 29 Nov 2022 14:53:07 +1000 +Subject: [PATCH xserver 5/6] 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. + +ZDI-CAN 19404 + +This vulnerability was discovered by: +Jan-Niklas Sohn working with Trend Micro Zero Day Initiative + +Signed-off-by: Peter Hutterer +--- + 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 + only in patch2: unchanged: --- xorg-server-21.1.3.orig/debian/patches/CVE-2022-46344-1.patch +++ xorg-server-21.1.3/debian/patches/CVE-2022-46344-1.patch @@ -0,0 +1,40 @@ +From bee46f23fbc2b2722753c3b7769c990b90c235a0 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 29 Nov 2022 13:24:00 +1000 +Subject: [PATCH xserver 2/6] 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 +--- + 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 + only in patch2: unchanged: --- xorg-server-21.1.3.orig/debian/patches/CVE-2022-46344-2.patch +++ xorg-server-21.1.3/debian/patches/CVE-2022-46344-2.patch @@ -0,0 +1,70 @@ +From 6f01a643c90724f32c19985e39de3bee9b14a310 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 29 Nov 2022 13:26:57 +1000 +Subject: [PATCH xserver 3/6] 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. + +ZDI-CAN 19405 + +This vulnerability was discovered by: +Jan-Niklas Sohn working with Trend Micro Zero Day Initiative + +Signed-off-by: Peter Hutterer +--- + 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 + only in patch2: unchanged: --- xorg-server-21.1.3.orig/debian/patches/dix-Don-t-send-touch-end-to-clients-that-do-async-gr.patch +++ xorg-server-21.1.3/debian/patches/dix-Don-t-send-touch-end-to-clients-that-do-async-gr.patch @@ -0,0 +1,50 @@ +From 9d05ee10c231edacc69b342677ae8c3cc32f97e5 Mon Sep 17 00:00:00 2001 +From: Povilas Kanapickas +Date: Sun, 16 Jan 2022 10:42:15 +0200 +Subject: [PATCH] dix: Don't send touch end to clients that do async grab + without touches + +GTK3 menu widget creates a selection for touch and other events and +after receiving touch events creates an async grab that excludes touch +events. Unfortunately it relies on X server not sending the touch end +event in order to function properly. Sending touch end event will cause +it to think that the initiating touch ended and when it actually ends, +the ButtonRelease event will make it think that the menu should be +closed. As a result, the menu will be open only for the duration of the +touch making it useless. + +This commit reverts f682e0563f736ed2c2c612ed575e05b6e3db945e. + +Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1255 + +Signed-off-by: Povilas Kanapickas +(cherry picked from commit 43e934a19f644cddedae73602e86429c9dc5074a) +--- + dix/events.c | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +--- a/dix/events.c ++++ b/dix/events.c +@@ -1491,16 +1491,13 @@ UpdateTouchesForGrab(DeviceIntPtr mouse) + CLIENT_BITS(listener->listener) == grab->resource) { + if (grab->grabtype == CORE || grab->grabtype == XI || + !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin)) { ++ /* Note that the grab will override any current listeners and if these listeners ++ already received touch events then this is the place to send touch end event ++ to complete the touch sequence. + +- if (listener->type == TOUCH_LISTENER_REGULAR && +- listener->state != TOUCH_LISTENER_AWAITING_BEGIN && +- listener->state != TOUCH_LISTENER_HAS_END) { +- /* if the listener already got any events relating to the touch, we must send +- a touch end because the grab overrides the previous listener and won't +- itself send any touch events. +- */ +- TouchEmitTouchEnd(mouse, ti, 0, listener->listener); +- } ++ Unfortunately GTK3 menu widget implementation relies on not getting touch end ++ event, so we can't fix the current behavior. ++ */ + listener->type = TOUCH_LISTENER_POINTER_GRAB; + } else { + listener->type = TOUCH_LISTENER_GRAB; only in patch2: unchanged: --- xorg-server-21.1.3.orig/debian/patches/re-calculate-the-clock-and-refresh-rate.diff +++ xorg-server-21.1.3/debian/patches/re-calculate-the-clock-and-refresh-rate.diff @@ -0,0 +1,81 @@ +From 973bbc7d5f0596827ca07126af789b6940331e0f Mon Sep 17 00:00:00 2001 +From: "Chia-Lin Kao (AceLan)" +Date: Tue, 8 Nov 2022 08:11:50 +0800 +Subject: [PATCH] hw/xfree86: re-calculate the clock and refresh rate +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +xserver fails to generate useable resolutions with 90Hz framerate +panels(encounter the same issue with 3 different 2.5k resolution +panels). All the resolutions shown by xrandr lead to blank screen except +the one written in EDID. +Ville Syrjälä from Intel provides a method to calculate the preferred +clock and refresh rate from the existing resolution table and this +works for the issue. + +Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1388 +Signed-off-by: Chia-Lin Kao (AceLan) +--- + hw/xfree86/common/xf86Mode.c | 2 ++ + hw/xfree86/drivers/modesetting/drmmode_display.c | 11 ++++++++++- + include/displaymode.h | 1 + + 3 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c +index 16dd529e3..136cd15d0 100644 +--- a/hw/xfree86/common/xf86Mode.c ++++ b/hw/xfree86/common/xf86Mode.c +@@ -230,6 +230,8 @@ xf86ModeStatusToString(ModeStatus status) + return "monitor doesn't support reduced blanking"; + case MODE_BANDWIDTH: + return "mode requires too much memory bandwidth"; ++ case MODE_DUPLICATE: ++ return "the same mode has been added"; + case MODE_BAD: + return "unknown reason"; + case MODE_ERROR: +diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c +index 65e8e6335..63bd93ecf 100644 +--- a/hw/xfree86/drivers/modesetting/drmmode_display.c ++++ b/hw/xfree86/drivers/modesetting/drmmode_display.c +@@ -2641,7 +2641,7 @@ static DisplayModePtr + drmmode_output_add_gtf_modes(xf86OutputPtr output, DisplayModePtr Modes) + { + xf86MonPtr mon = output->MonInfo; +- DisplayModePtr i, m, preferred = NULL; ++ DisplayModePtr i, j, m, preferred = NULL; + int max_x = 0, max_y = 0; + float max_vrefresh = 0.0; + +@@ -2673,6 +2673,15 @@ drmmode_output_add_gtf_modes(xf86OutputPtr output, DisplayModePtr Modes) + i->VDisplay >= preferred->VDisplay && + xf86ModeVRefresh(i) >= xf86ModeVRefresh(preferred)) + i->status = MODE_VSYNC; ++ i->Clock = i->Clock * xf86ModeVRefresh(preferred) / xf86ModeVRefresh(i); ++ i->VRefresh = xf86ModeVRefresh(preferred); ++ for (j = m; j != i; j = j->next) { ++ if (!strcmp(i->name, j->name) && ++ xf86ModeVRefresh(i) * (1 + SYNC_TOLERANCE) >= xf86ModeVRefresh(j) && ++ xf86ModeVRefresh(i) * (1 - SYNC_TOLERANCE) <= xf86ModeVRefresh(j)) { ++ i->status = MODE_DUPLICATE; ++ } ++ } + } + + xf86PruneInvalidModes(output->scrn, &m, FALSE); +diff --git a/include/displaymode.h b/include/displaymode.h +index ad01b87ec..561087717 100644 +--- a/include/displaymode.h ++++ b/include/displaymode.h +@@ -47,6 +47,7 @@ typedef enum { + MODE_ONE_SIZE, /* only one resolution is supported */ + MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ + MODE_BANDWIDTH, /* mode requires too much memory bandwidth */ ++ MODE_DUPLICATE, /* mode is duplicated */ + MODE_BAD = -2, /* unspecified reason */ + MODE_ERROR = -1 /* error condition */ + } ModeStatus; +-- +GitLab +