summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYogita Urade <yogita.urade@windriver.com>2025-03-21 12:55:52 +0000
committerSteve Sakoman <steve@sakoman.com>2025-03-27 08:16:30 -0700
commit9da4f8dc2b70709dd58b5003d3a765af9f5ef9b9 (patch)
tree1a31d53a1abfd46980bc07eb48a996d8fe13e3bc
parent5076bd268c7a47969d2d62f979656d635cfe9f0f (diff)
downloadpoky-9da4f8dc2b70709dd58b5003d3a765af9f5ef9b9.tar.gz
xwayland: fix CVE-2022-49737
In X.Org X server 20.11 through 21.1.16, when a client application uses easystroke for mouse gestures, the main thread modifies various data structures used by the input thread without acquiring a lock, aka a race condition. In particular, AttachDevice in dix/devices.c does not acquire an input lock. Reference: https://nvd.nist.gov/vuln/detail/CVE-2022-49737 Upstream patch: https://gitlab.freedesktop.org/xorg/xserver/-/commit/dc7cb45482cea6ccec22d117ca0b489500b4d0a0 (From OE-Core rev: 740ea9019cf5cf309c5a4ef380eac17d21078ac8) Signed-off-by: Yogita Urade <yogita.urade@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-graphics/xwayland/xwayland/CVE-2022-49737.patch90
-rw-r--r--meta/recipes-graphics/xwayland/xwayland_22.1.8.bb1
2 files changed, 91 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xwayland/xwayland/CVE-2022-49737.patch b/meta/recipes-graphics/xwayland/xwayland/CVE-2022-49737.patch
new file mode 100644
index 0000000000..86c9f59f8c
--- /dev/null
+++ b/meta/recipes-graphics/xwayland/xwayland/CVE-2022-49737.patch
@@ -0,0 +1,90 @@
1From dc7cb45482cea6ccec22d117ca0b489500b4d0a0 Mon Sep 17 00:00:00 2001
2From: tholin <thomas.lindroth@gmail.com>
3Date: Tue, 4 Jan 2022 12:08:11 +0000
4Subject: [PATCH] dix: Hold input lock for AttachDevice()
5
6Fix the following race:
7
8Possible data race during read of size 8 at 0xA112510 by thread #6
9Locks held: 1, at address 0x366B40
10 at 0x14C8B9: GetMaster (devices.c:2691)
11 by 0x15CFC5: IsFloating (events.c:346)
12 by 0x2B9554: miPointerGetScreen (mipointer.c:527)
13 by 0x1A5136: xf86PostButtonEventM (xf86Xinput.c:1379)
14 by 0x1A52BD: xf86PostButtonEvent (xf86Xinput.c:1345)
15 by 0x485F45B: EvdevProcessEvent (in /usr/lib64/xorg/modules/input/evdev_drv.so)
16 by 0x485FDAC: EvdevReadInput (in /usr/lib64/xorg/modules/input/evdev_drv.so)
17 by 0x195427: xf86ReadInput (xf86Events.c:247)
18 by 0x2CC113: InputReady (inputthread.c:180)
19 by 0x2CE4EA: ospoll_wait (ospoll.c:657)
20 by 0x2CC077: InputThreadDoWork (inputthread.c:369)
21 by 0x484A336: mythread_wrapper (hg_intercepts.c:406)
22
23This conflicts with a previous write of size 8 by thread #1
24Locks held: none
25 at 0x14D2C6: AttachDevice (devices.c:2609)
26 by 0x15CF85: ReattachToOldMaster (events.c:1457)
27 by 0x1647DD: DeactivateKeyboardGrab (events.c:1700)
28 by 0x25D7F1: ProcXIUngrabDevice (xigrabdev.c:169)
29 by 0x2552AD: ProcIDispatch (extinit.c:398)
30 by 0x155291: Dispatch (dispatch.c:479)
31 by 0x158CBA: dix_main (main.c:276)
32 by 0x143A3D: main (stubmain.c:34)
33 Address 0xa112510 is 336 bytes inside a block of size 904 alloc'd
34 at 0x4846571: calloc (vg_replace_malloc.c:1328)
35 by 0x14A0B3: AddInputDevice (devices.c:260)
36 by 0x1A31A0: xf86ActivateDevice (xf86Xinput.c:365)
37 by 0x1A4549: xf86NewInputDevice (xf86Xinput.c:948)
38 by 0x1A4B44: NewInputDeviceRequest (xf86Xinput.c:1090)
39 by 0x1B81FE: device_added (udev.c:282)
40 by 0x1B8516: config_udev_init (udev.c:439)
41 by 0x1B7091: config_init (config.c:50)
42 by 0x197970: InitInput (xf86Init.c:814)
43 by 0x158C6B: dix_main (main.c:250)
44 by 0x143A3D: main (stubmain.c:34)
45 Block was alloc'd by thread #1
46
47The steps to trigger the race are:
481. Main thread does cleanup at mipointer.c:360 setting the slave device's
49 miPointerPtr to null.
502. Input thread use MIPOINTER in mipointer.c and get the slave's
51 miPointerPtr = null.
523. Main thread updates dev->master at devices.c:2609.
534. MIPOINTER would now return the master's miPointerPtr but the input
54 thread already got the slave's miPointerPtr in step 2 and segfaults by
55 null ptr deref.
56
57Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1260
58Signed-off-by: Thomas Lindroth <thomas.lindroth@gmail.com>
59
60CVE: CVE-2022-49737
61Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/dc7cb45482cea6ccec22d117ca0b489500b4d0a0]
62
63Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
64---
65 dix/devices.c | 3 +++
66 1 file changed, 3 insertions(+)
67
68diff --git a/dix/devices.c b/dix/devices.c
69index 459f1ed..e5a6f02 100644
70--- a/dix/devices.c
71+++ b/dix/devices.c
72@@ -2671,6 +2671,8 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
73 if (IsFloating(dev) && !master && dev->enabled)
74 return Success;
75
76+ input_lock();
77+
78 /* free the existing sprite. */
79 if (IsFloating(dev) && dev->spriteInfo->paired == dev) {
80 screen = miPointerGetScreen(dev);
81@@ -2711,6 +2713,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
82 RecalculateMasterButtons(master);
83 }
84
85+ input_unlock();
86 /* XXX: in theory, the MD should change back to its old, original
87 * classes when the last SD is detached. Thanks to the XTEST devices,
88 * we'll always have an SD attached until the MD is removed.
89--
902.40.0
diff --git a/meta/recipes-graphics/xwayland/xwayland_22.1.8.bb b/meta/recipes-graphics/xwayland/xwayland_22.1.8.bb
index 6affd80e22..8b1fc85aab 100644
--- a/meta/recipes-graphics/xwayland/xwayland_22.1.8.bb
+++ b/meta/recipes-graphics/xwayland/xwayland_22.1.8.bb
@@ -42,6 +42,7 @@ SRC_URI = "https://www.x.org/archive/individual/xserver/xwayland-${PV}.tar.xz \
42 file://CVE-2025-26601-2.patch \ 42 file://CVE-2025-26601-2.patch \
43 file://CVE-2025-26601-3.patch \ 43 file://CVE-2025-26601-3.patch \
44 file://CVE-2025-26601-4.patch \ 44 file://CVE-2025-26601-4.patch \
45 file://CVE-2022-49737.patch \
45" 46"
46SRC_URI[sha256sum] = "d11eeee73290b88ea8da42a7d9350dedfaba856ce4ae44e58c045ad9ecaa2f73" 47SRC_URI[sha256sum] = "d11eeee73290b88ea8da42a7d9350dedfaba856ce4ae44e58c045ad9ecaa2f73"
47 48