summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHitendra Prajapati <hprajapati@mvista.com>2023-01-24 10:14:48 +0530
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-13 07:44:09 +0000
commit40bfc5ff44350fc5302ab803f3c82d70495c04a7 (patch)
treeac2be32049843e3598506d68b11d1042d512fa4f
parente3af3f6915f7f4f2084eb37a47b115c5836f5b63 (diff)
downloadpoky-40bfc5ff44350fc5302ab803f3c82d70495c04a7.tar.gz
xserver-xorg: Fix Multiple CVEs
CVE-2022-4283: xkb: reset the radio_groups pointer to NULL after freeing it Upstream-Status: Backport from https://gitlab.freedesktop.org/xorg/xserver/-/commit/ccdd431cd8f1cabae9d744f0514b6533c438908c CVE-2022-46340: Xtest: disallow GenericEvents in XTestSwapFakeInput Upstream-Status: Backport from https://gitlab.freedesktop.org/xorg/xserver/-/commit/b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63 CVE-2022-46341: Xi: disallow passive grabs with a detail > 255 Upstream-Status: Backport from https://gitlab.freedesktop.org/xorg/xserver/-/commit/51eb63b0ee1509c6c6b8922b0e4aa037faa6f78b CVE-2022-46342: Xext: free the XvRTVideoNotify when turning off from the same client Upstream-Status: Backport from https://gitlab.freedesktop.org/xorg/xserver/-/commit/b79f32b57cc0c1186b2899bce7cf89f7b325161b CVE-2022-46343: Xext: free the screen saver resource when replacing it Upstream-Status: Backport from https://gitlab.freedesktop.org/xorg/xserver/-/commit/842ca3ccef100ce010d1d8f5f6d6cc1915055900 CVE-2022-46344: Xi: avoid integer truncation in length check of ProcXIChangeProperty Upstream-Status: Backport from https://gitlab.freedesktop.org/xorg/xserver/-/commit/8f454b793e1f13c99872c15f0eed1d7f3b823fe8 (From OE-Core rev: dcc597d52a579fca44581ebd81b4a15fa56456fe) Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-4283.patch39
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46340.patch55
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46341.patch86
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46342.patch78
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46343.patch51
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46344.patch75
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.14.bb8
7 files changed, 391 insertions, 1 deletions
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-4283.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-4283.patch
new file mode 100644
index 0000000000..3f6b68fea8
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-4283.patch
@@ -0,0 +1,39 @@
1From ccdd431cd8f1cabae9d744f0514b6533c438908c Mon Sep 17 00:00:00 2001
2From: Peter Hutterer <peter.hutterer@who-t.net>
3Date: Mon, 5 Dec 2022 15:55:54 +1000
4Subject: [PATCH] xkb: reset the radio_groups pointer to NULL after freeing it
5
6Unlike other elements of the keymap, this pointer was freed but not
7reset. On a subsequent XkbGetKbdByName request, the server may access
8already freed memory.
9
10CVE-2022-4283, ZDI-CAN-19530
11
12This vulnerability was discovered by:
13Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
14
15Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
16Acked-by: Olivier Fourdan <ofourdan@redhat.com>
17
18Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/ccdd431cd8f1cabae9d744f0514b6533c438908c]
19CVE: CVE-2022-4283
20Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
21---
22 xkb/xkbUtils.c | 1 +
23 1 file changed, 1 insertion(+)
24
25diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
26index 8975ade..9bc51fc 100644
27--- a/xkb/xkbUtils.c
28+++ b/xkb/xkbUtils.c
29@@ -1327,6 +1327,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst)
30 }
31 else {
32 free(dst->names->radio_groups);
33+ dst->names->radio_groups = NULL;
34 }
35 dst->names->num_rg = src->names->num_rg;
36
37--
382.25.1
39
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46340.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46340.patch
new file mode 100644
index 0000000000..a6c97485cd
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46340.patch
@@ -0,0 +1,55 @@
1From b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63 Mon Sep 17 00:00:00 2001
2From: Peter Hutterer <peter.hutterer@who-t.net>
3Date: Tue, 29 Nov 2022 12:55:45 +1000
4Subject: [PATCH] Xtest: disallow GenericEvents in XTestSwapFakeInput
5
6XTestSwapFakeInput assumes all events in this request are
7sizeof(xEvent) and iterates through these in 32-byte increments.
8However, a GenericEvent may be of arbitrary length longer than 32 bytes,
9so any GenericEvent in this list would result in subsequent events to be
10misparsed.
11
12Additional, the swapped event is written into a stack-allocated struct
13xEvent (size 32 bytes). For any GenericEvent longer than 32 bytes,
14swapping the event may thus smash the stack like an avocado on toast.
15
16Catch this case early and return BadValue for any GenericEvent.
17Which is what would happen in unswapped setups anyway since XTest
18doesn't support GenericEvent.
19
20CVE-2022-46340, ZDI-CAN 19265
21
22This vulnerability was discovered by:
23Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
24
25Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
26Acked-by: Olivier Fourdan <ofourdan@redhat.com>
27
28Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63]
29CVE: CVE-2022-46340
30Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
31---
32 Xext/xtest.c | 5 +++--
33 1 file changed, 3 insertions(+), 2 deletions(-)
34
35diff --git a/Xext/xtest.c b/Xext/xtest.c
36index 38b8012..bf11789 100644
37--- a/Xext/xtest.c
38+++ b/Xext/xtest.c
39@@ -501,10 +501,11 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
40
41 nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
42 for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
43+ int evtype = ev->u.u.type & 0x177;
44 /* Swap event */
45- proc = EventSwapVector[ev->u.u.type & 0177];
46+ proc = EventSwapVector[evtype];
47 /* no swapping proc; invalid event type? */
48- if (!proc || proc == NotImplemented) {
49+ if (!proc || proc == NotImplemented || evtype == GenericEvent) {
50 client->errorValue = ev->u.u.type;
51 return BadValue;
52 }
53--
542.25.1
55
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46341.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46341.patch
new file mode 100644
index 0000000000..0ef6e5fc9f
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46341.patch
@@ -0,0 +1,86 @@
1From 51eb63b0ee1509c6c6b8922b0e4aa037faa6f78b Mon Sep 17 00:00:00 2001
2From: Peter Hutterer <peter.hutterer@who-t.net>
3Date: Tue, 29 Nov 2022 13:55:32 +1000
4Subject: [PATCH] Xi: disallow passive grabs with a detail > 255
5
6The XKB protocol effectively prevents us from ever using keycodes above
7255. For buttons it's theoretically possible but realistically too niche
8to worry about. For all other passive grabs, the detail must be zero
9anyway.
10
11This fixes an OOB write:
12
13ProcXIPassiveUngrabDevice() calls DeletePassiveGrabFromList with a
14temporary grab struct which contains tempGrab->detail.exact = stuff->detail.
15For matching existing grabs, DeleteDetailFromMask is called with the
16stuff->detail value. This function creates a new mask with the one bit
17representing stuff->detail cleared.
18
19However, the array size for the new mask is 8 * sizeof(CARD32) bits,
20thus any detail above 255 results in an OOB array write.
21
22CVE-2022-46341, ZDI-CAN 19381
23
24This vulnerability was discovered by:
25Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
26
27Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
28Acked-by: Olivier Fourdan <ofourdan@redhat.com>
29
30Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/51eb63b0ee1509c6c6b8922b0e4aa037faa6f78b]
31CVE: CVE-2022-46341
32Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
33---
34 Xi/xipassivegrab.c | 22 ++++++++++++++--------
35 1 file changed, 14 insertions(+), 8 deletions(-)
36
37diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
38index d30f51f..89a5910 100644
39--- a/Xi/xipassivegrab.c
40+++ b/Xi/xipassivegrab.c
41@@ -133,6 +133,12 @@ ProcXIPassiveGrabDevice(ClientPtr client)
42 return BadValue;
43 }
44
45+ /* XI2 allows 32-bit keycodes but thanks to XKB we can never
46+ * implement this. Just return an error for all keycodes that
47+ * cannot work anyway, same for buttons > 255. */
48+ if (stuff->detail > 255)
49+ return XIAlreadyGrabbed;
50+
51 if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1],
52 stuff->mask_len * 4) != Success)
53 return BadValue;
54@@ -203,14 +209,8 @@ ProcXIPassiveGrabDevice(ClientPtr client)
55 &param, XI2, &mask);
56 break;
57 case XIGrabtypeKeycode:
58- /* XI2 allows 32-bit keycodes but thanks to XKB we can never
59- * implement this. Just return an error for all keycodes that
60- * cannot work anyway */
61- if (stuff->detail > 255)
62- status = XIAlreadyGrabbed;
63- else
64- status = GrabKey(client, dev, mod_dev, stuff->detail,
65- &param, XI2, &mask);
66+ status = GrabKey(client, dev, mod_dev, stuff->detail,
67+ &param, XI2, &mask);
68 break;
69 case XIGrabtypeEnter:
70 case XIGrabtypeFocusIn:
71@@ -319,6 +319,12 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
72 return BadValue;
73 }
74
75+ /* We don't allow passive grabs for details > 255 anyway */
76+ if (stuff->detail > 255) {
77+ client->errorValue = stuff->detail;
78+ return BadValue;
79+ }
80+
81 rc = dixLookupWindow(&win, stuff->grab_window, client, DixSetAttrAccess);
82 if (rc != Success)
83 return rc;
84--
852.25.1
86
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46342.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46342.patch
new file mode 100644
index 0000000000..23fef3f321
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46342.patch
@@ -0,0 +1,78 @@
1From b79f32b57cc0c1186b2899bce7cf89f7b325161b Mon Sep 17 00:00:00 2001
2From: Peter Hutterer <peter.hutterer@who-t.net>
3Date: Wed, 30 Nov 2022 11:20:40 +1000
4Subject: [PATCH] Xext: free the XvRTVideoNotify when turning off from the same
5 client
6
7This fixes a use-after-free bug:
8
9When a client first calls XvdiSelectVideoNotify() on a drawable with a
10TRUE onoff argument, a struct XvVideoNotifyRec is allocated. This struct
11is added twice to the resources:
12 - as the drawable's XvRTVideoNotifyList. This happens only once per
13 drawable, subsequent calls append to this list.
14 - as the client's XvRTVideoNotify. This happens for every client.
15
16The struct keeps the ClientPtr around once it has been added for a
17client. The idea, presumably, is that if the client disconnects we can remove
18all structs from the drawable's list that match the client (by resetting
19the ClientPtr to NULL), but if the drawable is destroyed we can remove
20and free the whole list.
21
22However, if the same client then calls XvdiSelectVideoNotify() on the
23same drawable with a FALSE onoff argument, only the ClientPtr on the
24existing struct was set to NULL. The struct itself remained in the
25client's resources.
26
27If the drawable is now destroyed, the resource system invokes
28XvdiDestroyVideoNotifyList which frees the whole list for this drawable
29- including our struct. This function however does not free the resource
30for the client since our ClientPtr is NULL.
31
32Later, when the client is destroyed and the resource system invokes
33XvdiDestroyVideoNotify, we unconditionally set the ClientPtr to NULL. On
34a struct that has been freed previously. This is generally frowned upon.
35
36Fix this by calling FreeResource() on the second call instead of merely
37setting the ClientPtr to NULL. This removes the struct from the client
38resources (but not from the list), ensuring that it won't be accessed
39again when the client quits.
40
41Note that the assignment tpn->client = NULL; is superfluous since the
42XvdiDestroyVideoNotify function will do this anyway. But it's left for
43clarity and to match a similar invocation in XvdiSelectPortNotify.
44
45CVE-2022-46342, ZDI-CAN 19400
46
47This vulnerability was discovered by:
48Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
49
50Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
51Acked-by: Olivier Fourdan <ofourdan@redhat.com>
52
53Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/b79f32b57cc0c1186b2899bce7cf89f7b325161b]
54CVE: CVE-2022-46342
55Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
56---
57 Xext/xvmain.c | 4 +++-
58 1 file changed, 3 insertions(+), 1 deletion(-)
59
60diff --git a/Xext/xvmain.c b/Xext/xvmain.c
61index c520c7d..5f4c174 100644
62--- a/Xext/xvmain.c
63+++ b/Xext/xvmain.c
64@@ -811,8 +811,10 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
65 tpn = pn;
66 while (tpn) {
67 if (tpn->client == client) {
68- if (!onoff)
69+ if (!onoff) {
70 tpn->client = NULL;
71+ FreeResource(tpn->id, XvRTVideoNotify);
72+ }
73 return Success;
74 }
75 if (!tpn->client)
76--
772.25.1
78
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46343.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46343.patch
new file mode 100644
index 0000000000..838f7d3726
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46343.patch
@@ -0,0 +1,51 @@
1From 842ca3ccef100ce010d1d8f5f6d6cc1915055900 Mon Sep 17 00:00:00 2001
2From: Peter Hutterer <peter.hutterer@who-t.net>
3Date: Tue, 29 Nov 2022 14:53:07 +1000
4Subject: [PATCH] Xext: free the screen saver resource when replacing it
5
6This fixes a use-after-free bug:
7
8When a client first calls ScreenSaverSetAttributes(), a struct
9ScreenSaverAttrRec is allocated and added to the client's
10resources.
11
12When the same client calls ScreenSaverSetAttributes() again, a new
13struct ScreenSaverAttrRec is allocated, replacing the old struct. The
14old struct was freed but not removed from the clients resources.
15
16Later, when the client is destroyed the resource system invokes
17ScreenSaverFreeAttr and attempts to clean up the already freed struct.
18
19Fix this by letting the resource system free the old attrs instead.
20
21CVE-2022-46343, ZDI-CAN 19404
22
23This vulnerability was discovered by:
24Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
25
26Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
27Acked-by: Olivier Fourdan <ofourdan@redhat.com>
28
29Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/842ca3ccef100ce010d1d8f5f6d6cc1915055900]
30CVE: CVE-2022-46343
31Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
32---
33 Xext/saver.c | 2 +-
34 1 file changed, 1 insertion(+), 1 deletion(-)
35
36diff --git a/Xext/saver.c b/Xext/saver.c
37index c23907d..05b9ca3 100644
38--- a/Xext/saver.c
39+++ b/Xext/saver.c
40@@ -1051,7 +1051,7 @@ ScreenSaverSetAttributes(ClientPtr client)
41 pVlist++;
42 }
43 if (pPriv->attr)
44- FreeScreenAttr(pPriv->attr);
45+ FreeResource(pPriv->attr->resource, AttrType);
46 pPriv->attr = pAttr;
47 pAttr->resource = FakeClientID(client->index);
48 if (!AddResource(pAttr->resource, AttrType, (void *) pAttr))
49--
502.25.1
51
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46344.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46344.patch
new file mode 100644
index 0000000000..e25afa0d16
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-46344.patch
@@ -0,0 +1,75 @@
1From 8f454b793e1f13c99872c15f0eed1d7f3b823fe8 Mon Sep 17 00:00:00 2001
2From: Peter Hutterer <peter.hutterer@who-t.net>
3Date: Tue, 29 Nov 2022 13:26:57 +1000
4Subject: [PATCH] Xi: avoid integer truncation in length check of
5 ProcXIChangeProperty
6
7This fixes an OOB read and the resulting information disclosure.
8
9Length calculation for the request was clipped to a 32-bit integer. With
10the correct stuff->num_items value the expected request size was
11truncated, passing the REQUEST_FIXED_SIZE check.
12
13The server then proceeded with reading at least stuff->num_items bytes
14(depending on stuff->format) from the request and stuffing whatever it
15finds into the property. In the process it would also allocate at least
16stuff->num_items bytes, i.e. 4GB.
17
18The same bug exists in ProcChangeProperty and ProcXChangeDeviceProperty,
19so let's fix that too.
20
21CVE-2022-46344, ZDI-CAN 19405
22
23This vulnerability was discovered by:
24Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
25
26Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
27Acked-by: Olivier Fourdan <ofourdan@redhat.com>
28
29Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/8f454b793e1f13c99872c15f0eed1d7f3b823fe8]
30CVE: CVE-2022-46344
31Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
32---
33 Xi/xiproperty.c | 4 ++--
34 dix/property.c | 3 ++-
35 2 files changed, 4 insertions(+), 3 deletions(-)
36
37diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
38index 6ec419e..0cfa6e3 100644
39--- a/Xi/xiproperty.c
40+++ b/Xi/xiproperty.c
41@@ -890,7 +890,7 @@ ProcXChangeDeviceProperty(ClientPtr client)
42 REQUEST(xChangeDevicePropertyReq);
43 DeviceIntPtr dev;
44 unsigned long len;
45- int totalSize;
46+ uint64_t totalSize;
47 int rc;
48
49 REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
50@@ -1128,7 +1128,7 @@ ProcXIChangeProperty(ClientPtr client)
51 {
52 int rc;
53 DeviceIntPtr dev;
54- int totalSize;
55+ uint64_t totalSize;
56 unsigned long len;
57
58 REQUEST(xXIChangePropertyReq);
59diff --git a/dix/property.c b/dix/property.c
60index ff1d669..6fdb74a 100644
61--- a/dix/property.c
62+++ b/dix/property.c
63@@ -205,7 +205,8 @@ ProcChangeProperty(ClientPtr client)
64 WindowPtr pWin;
65 char format, mode;
66 unsigned long len;
67- int sizeInBytes, totalSize, err;
68+ int sizeInBytes, err;
69+ uint64_t totalSize;
70
71 REQUEST(xChangePropertyReq);
72
73--
742.25.1
75
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.14.bb b/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.14.bb
index 4f5528f78b..ab18a87a3d 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.14.bb
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.14.bb
@@ -8,7 +8,13 @@ SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.pat
8 file://CVE-2022-3550.patch \ 8 file://CVE-2022-3550.patch \
9 file://CVE-2022-3551.patch \ 9 file://CVE-2022-3551.patch \
10 file://CVE-2022-3553.patch \ 10 file://CVE-2022-3553.patch \
11 " 11 file://CVE-2022-4283.patch \
12 file://CVE-2022-46340.patch \
13 file://CVE-2022-46341.patch \
14 file://CVE-2022-46342.patch \
15 file://CVE-2022-46343.patch \
16 file://CVE-2022-46344.patch \
17"
12SRC_URI[md5sum] = "453fc86aac8c629b3a5b77e8dcca30bf" 18SRC_URI[md5sum] = "453fc86aac8c629b3a5b77e8dcca30bf"
13SRC_URI[sha256sum] = "54b199c9280ff8bf0f73a54a759645bd0eeeda7255d1c99310d5b7595f3ac066" 19SRC_URI[sha256sum] = "54b199c9280ff8bf0f73a54a759645bd0eeeda7255d1c99310d5b7595f3ac066"
14 20