diff options
| author | Vijay Anusuri <vanusuri@mvista.com> | 2025-03-04 17:49:06 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-03-08 06:35:36 -0800 |
| commit | 3bbaf11178b07d173bd1ed3c58894a810c62dbe1 (patch) | |
| tree | d40b454ae08eb60f902105dce765f95c238a9d58 /meta/recipes-graphics | |
| parent | b442e018222188ca49120931e6b18c5ebd9f41c8 (diff) | |
| download | poky-3bbaf11178b07d173bd1ed3c58894a810c62dbe1.tar.gz | |
xwayland: Fix CVE-2024-21886
The patches are copied from xserver-xorg recipe.
CVE reported for both and patches apply on both.
Upstream-Commit:
https://gitlab.freedesktop.org/xorg/xserver/-/commit/bc1fdbe46559dd947674375946bbef54dd0ce36b
& https://gitlab.freedesktop.org/xorg/xserver/-/commit/26769aa71fcbe0a8403b7fb13b7c9010cc07c3a8
(From OE-Core rev: 77487fb0756951e29628f41ff00db12a5f9d7c27)
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-graphics')
3 files changed, 133 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xwayland/xwayland/CVE-2024-21886-1.patch b/meta/recipes-graphics/xwayland/xwayland/CVE-2024-21886-1.patch new file mode 100644 index 0000000000..1e1c782963 --- /dev/null +++ b/meta/recipes-graphics/xwayland/xwayland/CVE-2024-21886-1.patch | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | From bc1fdbe46559dd947674375946bbef54dd0ce36b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= <jexposit@redhat.com> | ||
| 3 | Date: Fri, 22 Dec 2023 18:28:31 +0100 | ||
| 4 | Subject: [PATCH] Xi: do not keep linked list pointer during recursion | ||
| 5 | |||
| 6 | The `DisableDevice()` function is called whenever an enabled device | ||
| 7 | is disabled and it moves the device from the `inputInfo.devices` linked | ||
| 8 | list to the `inputInfo.off_devices` linked list. | ||
| 9 | |||
| 10 | However, its link/unlink operation has an issue during the recursive | ||
| 11 | call to `DisableDevice()` due to the `prev` pointer pointing to a | ||
| 12 | removed device. | ||
| 13 | |||
| 14 | This issue leads to a length mismatch between the total number of | ||
| 15 | devices and the number of device in the list, leading to a heap | ||
| 16 | overflow and, possibly, to local privilege escalation. | ||
| 17 | |||
| 18 | Simplify the code that checked whether the device passed to | ||
| 19 | `DisableDevice()` was in `inputInfo.devices` or not and find the | ||
| 20 | previous device after the recursion. | ||
| 21 | |||
| 22 | CVE-2024-21886, ZDI-CAN-22840 | ||
| 23 | |||
| 24 | This vulnerability was discovered by: | ||
| 25 | Jan-Niklas Sohn working with Trend Micro Zero Day Initiative | ||
| 26 | |||
| 27 | Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/bc1fdbe46559dd947674375946bbef54dd0ce36b] | ||
| 28 | CVE: CVE-2024-21886 | ||
| 29 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
| 30 | --- | ||
| 31 | dix/devices.c | 15 ++++++++++++--- | ||
| 32 | 1 file changed, 12 insertions(+), 3 deletions(-) | ||
| 33 | |||
| 34 | diff --git a/dix/devices.c b/dix/devices.c | ||
| 35 | index dca98c8d1b..389d28a23c 100644 | ||
| 36 | --- a/dix/devices.c | ||
| 37 | +++ b/dix/devices.c | ||
| 38 | @@ -453,14 +453,20 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) | ||
| 39 | { | ||
| 40 | DeviceIntPtr *prev, other; | ||
| 41 | BOOL enabled; | ||
| 42 | + BOOL dev_in_devices_list = FALSE; | ||
| 43 | int flags[MAXDEVICES] = { 0 }; | ||
| 44 | |||
| 45 | if (!dev->enabled) | ||
| 46 | return TRUE; | ||
| 47 | |||
| 48 | - for (prev = &inputInfo.devices; | ||
| 49 | - *prev && (*prev != dev); prev = &(*prev)->next); | ||
| 50 | - if (*prev != dev) | ||
| 51 | + for (other = inputInfo.devices; other; other = other->next) { | ||
| 52 | + if (other == dev) { | ||
| 53 | + dev_in_devices_list = TRUE; | ||
| 54 | + break; | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + if (!dev_in_devices_list) | ||
| 59 | return FALSE; | ||
| 60 | |||
| 61 | TouchEndPhysicallyActiveTouches(dev); | ||
| 62 | @@ -511,6 +517,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) | ||
| 63 | LeaveWindow(dev); | ||
| 64 | SetFocusOut(dev); | ||
| 65 | |||
| 66 | + for (prev = &inputInfo.devices; | ||
| 67 | + *prev && (*prev != dev); prev = &(*prev)->next); | ||
| 68 | + | ||
| 69 | *prev = dev->next; | ||
| 70 | dev->next = inputInfo.off_devices; | ||
| 71 | inputInfo.off_devices = dev; | ||
| 72 | -- | ||
| 73 | GitLab | ||
| 74 | |||
diff --git a/meta/recipes-graphics/xwayland/xwayland/CVE-2024-21886-2.patch b/meta/recipes-graphics/xwayland/xwayland/CVE-2024-21886-2.patch new file mode 100644 index 0000000000..af607df4f0 --- /dev/null +++ b/meta/recipes-graphics/xwayland/xwayland/CVE-2024-21886-2.patch | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | From 26769aa71fcbe0a8403b7fb13b7c9010cc07c3a8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 3 | Date: Fri, 5 Jan 2024 09:40:27 +1000 | ||
| 4 | Subject: [PATCH] dix: when disabling a master, float disabled slaved devices | ||
| 5 | too | ||
| 6 | |||
| 7 | Disabling a master device floats all slave devices but we didn't do this | ||
| 8 | to already-disabled slave devices. As a result those devices kept their | ||
| 9 | reference to the master device resulting in access to already freed | ||
| 10 | memory if the master device was removed before the corresponding slave | ||
| 11 | device. | ||
| 12 | |||
| 13 | And to match this behavior, also forcibly reset that pointer during | ||
| 14 | CloseDownDevices(). | ||
| 15 | |||
| 16 | Related to CVE-2024-21886, ZDI-CAN-22840 | ||
| 17 | |||
| 18 | Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/26769aa71fcbe0a8403b7fb13b7c9010cc07c3a8] | ||
| 19 | CVE: CVE-2024-21886 | ||
| 20 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
| 21 | --- | ||
| 22 | dix/devices.c | 12 ++++++++++++ | ||
| 23 | 1 file changed, 12 insertions(+) | ||
| 24 | |||
| 25 | diff --git a/dix/devices.c b/dix/devices.c | ||
| 26 | index 389d28a23c..84a6406d13 100644 | ||
| 27 | --- a/dix/devices.c | ||
| 28 | +++ b/dix/devices.c | ||
| 29 | @@ -483,6 +483,13 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) | ||
| 30 | flags[other->id] |= XISlaveDetached; | ||
| 31 | } | ||
| 32 | } | ||
| 33 | + | ||
| 34 | + for (other = inputInfo.off_devices; other; other = other->next) { | ||
| 35 | + if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev) { | ||
| 36 | + AttachDevice(NULL, other, NULL); | ||
| 37 | + flags[other->id] |= XISlaveDetached; | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | } | ||
| 41 | else { | ||
| 42 | for (other = inputInfo.devices; other; other = other->next) { | ||
| 43 | @@ -1088,6 +1095,11 @@ CloseDownDevices(void) | ||
| 44 | dev->master = NULL; | ||
| 45 | } | ||
| 46 | |||
| 47 | + for (dev = inputInfo.off_devices; dev; dev = dev->next) { | ||
| 48 | + if (!IsMaster(dev) && !IsFloating(dev)) | ||
| 49 | + dev->master = NULL; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | CloseDeviceList(&inputInfo.devices); | ||
| 53 | CloseDeviceList(&inputInfo.off_devices); | ||
| 54 | |||
| 55 | -- | ||
| 56 | GitLab | ||
| 57 | |||
diff --git a/meta/recipes-graphics/xwayland/xwayland_22.1.8.bb b/meta/recipes-graphics/xwayland/xwayland_22.1.8.bb index c7e5c7bd81..1d4e699d94 100644 --- a/meta/recipes-graphics/xwayland/xwayland_22.1.8.bb +++ b/meta/recipes-graphics/xwayland/xwayland_22.1.8.bb | |||
| @@ -22,6 +22,8 @@ SRC_URI = "https://www.x.org/archive/individual/xserver/xwayland-${PV}.tar.xz \ | |||
| 22 | file://CVE-2024-0229-3.patch \ | 22 | file://CVE-2024-0229-3.patch \ |
| 23 | file://CVE-2024-0229-4.patch \ | 23 | file://CVE-2024-0229-4.patch \ |
| 24 | file://CVE-2024-21885.patch \ | 24 | file://CVE-2024-21885.patch \ |
| 25 | file://CVE-2024-21886-1.patch \ | ||
| 26 | file://CVE-2024-21886-2.patch \ | ||
| 25 | " | 27 | " |
| 26 | SRC_URI[sha256sum] = "d11eeee73290b88ea8da42a7d9350dedfaba856ce4ae44e58c045ad9ecaa2f73" | 28 | SRC_URI[sha256sum] = "d11eeee73290b88ea8da42a7d9350dedfaba856ce4ae44e58c045ad9ecaa2f73" |
| 27 | 29 | ||
