Skip to content

Commit 4281707

Browse files
1 parent 022dc69 commit 4281707

File tree

6 files changed

+273
-2
lines changed

6 files changed

+273
-2
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
From 0885e0b26225c90534642fe911632ec0779eebee Mon Sep 17 00:00:00 2001
2+
From: Olivier Fourdan <[email protected]>
3+
Date: Fri, 28 Mar 2025 09:43:52 +0100
4+
Subject: [PATCH] render: Avoid 0 or less animated cursors
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/0885e0b26225c90534642fe911632ec0779eebee.patch
10+
11+
Animated cursors use a series of cursors that the client can set.
12+
13+
By default, the Xserver assumes at least one cursor is specified
14+
while a client may actually pass no cursor at all.
15+
16+
That causes an out-of-bound read creating the animated cursor and a
17+
crash of the Xserver:
18+
19+
| Invalid read of size 8
20+
| at 0x5323F4: AnimCursorCreate (animcur.c:325)
21+
| by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
22+
| by 0x52DC80: ProcRenderDispatch (render.c:1999)
23+
| by 0x4A1E9D: Dispatch (dispatch.c:560)
24+
| by 0x4B0169: dix_main (main.c:284)
25+
| by 0x4287F5: main (stubmain.c:34)
26+
| Address 0x59aa010 is 0 bytes after a block of size 0 alloc'd
27+
| at 0x48468D3: reallocarray (vg_replace_malloc.c:1803)
28+
| by 0x52D3DA: ProcRenderCreateAnimCursor (render.c:1802)
29+
| by 0x52DC80: ProcRenderDispatch (render.c:1999)
30+
| by 0x4A1E9D: Dispatch (dispatch.c:560)
31+
| by 0x4B0169: dix_main (main.c:284)
32+
| by 0x4287F5: main (stubmain.c:34)
33+
|
34+
| Invalid read of size 2
35+
| at 0x5323F7: AnimCursorCreate (animcur.c:325)
36+
| by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
37+
| by 0x52DC80: ProcRenderDispatch (render.c:1999)
38+
| by 0x4A1E9D: Dispatch (dispatch.c:560)
39+
| by 0x4B0169: dix_main (main.c:284)
40+
| by 0x4287F5: main (stubmain.c:34)
41+
| Address 0x8 is not stack'd, malloc'd or (recently) free'd
42+
43+
To avoid the issue, check the number of cursors specified and return a
44+
BadValue error in both the proc handler (early) and the animated cursor
45+
creation (as this is a public function) if there is 0 or less cursor.
46+
47+
CVE-2025-49175
48+
49+
This issue was discovered by Nils Emmerich <[email protected]> and
50+
reported by Julian Suleder via ERNW Vulnerability Disclosure.
51+
52+
Signed-off-by: Olivier Fourdan <[email protected]>
53+
Reviewed-by: José Expósito <[email protected]>
54+
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
55+
---
56+
render/animcur.c | 3 +++
57+
render/render.c | 2 ++
58+
2 files changed, 5 insertions(+)
59+
60+
diff --git a/render/animcur.c b/render/animcur.c
61+
index f906cd8130..1194cee7e7 100644
62+
--- a/render/animcur.c
63+
+++ b/render/animcur.c
64+
@@ -305,6 +305,9 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
65+
int rc = BadAlloc, i;
66+
AnimCurPtr ac;
67+
68+
+ if (ncursor <= 0)
69+
+ return BadValue;
70+
+
71+
for (i = 0; i < screenInfo.numScreens; i++)
72+
if (!GetAnimCurScreen(screenInfo.screens[i]))
73+
return BadImplementation;
74+
diff --git a/render/render.c b/render/render.c
75+
index 113f6e0c5a..fe9f03c8c8 100644
76+
--- a/render/render.c
77+
+++ b/render/render.c
78+
@@ -1799,6 +1799,8 @@ ProcRenderCreateAnimCursor(ClientPtr client)
79+
ncursor =
80+
(client->req_len -
81+
(bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
82+
+ if (ncursor <= 0)
83+
+ return BadValue;
84+
cursors = xallocarray(ncursor, sizeof(CursorPtr) + sizeof(CARD32));
85+
if (!cursors)
86+
return BadAlloc;
87+
--
88+
GitLab
89+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From fec15c9463b629600306a25fb01801353b6a9bf6 Mon Sep 17 00:00:00 2001
2+
From: Kevin Lockwood <[email protected]>
3+
Date: Mon, 23 Jun 2025 15:22:44 -0700
4+
Subject: [PATCH] [Medium] Patch xorg-x11-server-Xwayland for CVE-2025-49177
5+
6+
Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/ab02fb96b1c701c3bb47617d965522c34befa6af.patch
7+
8+
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
9+
10+
Only edit to the upstream patch was because the patcher could not find
11+
where to position a hunk
12+
---
13+
xfixes/disconnect.c | 3 ++-
14+
1 file changed, 2 insertions(+), 1 deletion(-)
15+
16+
diff --git a/xfixes/disconnect.c b/xfixes/disconnect.c
17+
index e412942..b3529af 100644
18+
--- a/xfixes/disconnect.c
19+
+++ b/xfixes/disconnect.c
20+
@@ -69,6 +69,7 @@ ProcXFixesSetClientDisconnectMode(ClientPtr client)
21+
ClientDisconnectPtr pDisconnect = GetClientDisconnect(client);
22+
23+
REQUEST(xXFixesSetClientDisconnectModeReq);
24+
+ REQUEST_SIZE_MATCH(xXFixesSetClientDisconnectModeReq);
25+
26+
pDisconnect->disconnect_mode = stuff->disconnect_mode;
27+
28+
@@ -82,7 +83,7 @@ SProcXFixesSetClientDisconnectMode(ClientPtr client)
29+
30+
swaps(&stuff->length);
31+
32+
- REQUEST_AT_LEAST_SIZE(xXFixesSetClientDisconnectModeReq);
33+
+ REQUEST_SIZE_MATCH(xXFixesSetClientDisconnectModeReq);
34+
35+
swapl(&stuff->disconnect_mode);
36+
37+
--
38+
2.34.1
39+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From d55c54cecb5e83eaa2d56bed5cc4461f9ba318c2 Mon Sep 17 00:00:00 2001
2+
From: Olivier Fourdan <[email protected]>
3+
Date: Mon, 28 Apr 2025 10:46:03 +0200
4+
Subject: [PATCH] os: Account for bytes to ignore when sharing input buffer
5+
6+
Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/d55c54cecb5e83eaa2d56bed5cc4461f9ba318c2.patch
7+
8+
When reading requests from the clients, the input buffer might be shared
9+
and used between different clients.
10+
11+
If a given client sends a full request with non-zero bytes to ignore,
12+
the bytes to ignore may still be non-zero even though the request is
13+
full, in which case the buffer could be shared with another client who's
14+
request will not be processed because of those bytes to ignore, leading
15+
to a possible hang of the other client request.
16+
17+
To avoid the issue, make sure we have zero bytes to ignore left in the
18+
input request when sharing the input buffer with another client.
19+
20+
CVE-2025-49178
21+
22+
This issue was discovered by Nils Emmerich <[email protected]> and
23+
reported by Julian Suleder via ERNW Vulnerability Disclosure.
24+
25+
Signed-off-by: Olivier Fourdan <[email protected]>
26+
Reviewed-by: Peter Hutterer <[email protected]>
27+
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
28+
---
29+
os/io.c | 2 +-
30+
1 file changed, 1 insertion(+), 1 deletion(-)
31+
32+
diff --git a/os/io.c b/os/io.c
33+
index 3e39c10e6f..e7b76b9cea 100644
34+
--- a/os/io.c
35+
+++ b/os/io.c
36+
@@ -441,7 +441,7 @@ ReadRequestFromClient(ClientPtr client)
37+
*/
38+
39+
gotnow -= needed;
40+
- if (!gotnow)
41+
+ if (!gotnow && !oci->ignoreBytes)
42+
AvailableInput = oc;
43+
if (move_header) {
44+
if (client->req_len < bytes_to_int32(sizeof(xBigReq) - sizeof(xReq))) {
45+
--
46+
GitLab
47+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From dcf8726020de572e28ae4f9b0b40be2a6ea27a2c Mon Sep 17 00:00:00 2001
2+
From: Kevin Lockwood <[email protected]>
3+
Date: Mon, 23 Jun 2025 14:21:55 -0700
4+
Subject: [PATCH] Patch xorg-x11-server-Xwayland for CVE-2025-49179
5+
6+
Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/2bde9ca49a8fd9a1e6697d5e7ef837870d66f5d4.patch
7+
8+
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
9+
---
10+
record/record.c | 8 ++++++++
11+
1 file changed, 8 insertions(+)
12+
13+
diff --git a/record/record.c b/record/record.c
14+
index ca9254c..311ec1a 100644
15+
--- a/record/record.c
16+
+++ b/record/record.c
17+
@@ -46,6 +46,7 @@ and Jim Haggerty of Metheus.
18+
#include "swaprep.h"
19+
#include "inputstr.h"
20+
#include "scrnintstr.h"
21+
+#include "include/opaque.h"
22+
23+
#include <stdio.h>
24+
#include <assert.h>
25+
@@ -1299,6 +1300,13 @@ RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client,
26+
int i;
27+
XID recordingClient;
28+
29+
+ /* LimitClients is 2048 at max, way less that MAXINT */
30+
+ if (stuff->nClients > LimitClients)
31+
+ return BadValue;
32+
+
33+
+ if (stuff->nRanges > (MAXINT - 4 * stuff->nClients) / SIZEOF(xRecordRange))
34+
+ return BadValue;
35+
+
36+
if (((client->req_len << 2) - SIZEOF(xRecordRegisterClientsReq)) !=
37+
4 * stuff->nClients + SIZEOF(xRecordRange) * stuff->nRanges)
38+
return BadLength;
39+
--
40+
2.34.1
41+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 3c3a4b767b16174d3213055947ea7f4f88e10ec6 Mon Sep 17 00:00:00 2001
2+
From: Olivier Fourdan <[email protected]>
3+
Date: Tue, 20 May 2025 15:18:19 +0200
4+
Subject: [PATCH] randr: Check for overflow in RRChangeProviderProperty()
5+
6+
Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/3c3a4b767b16174d3213055947ea7f4f88e10ec6.patch
7+
8+
A client might send a request causing an integer overflow when computing
9+
the total size to allocate in RRChangeProviderProperty().
10+
11+
To avoid the issue, check that total length in bytes won't exceed the
12+
maximum integer value.
13+
14+
CVE-2025-49180
15+
16+
This issue was discovered by Nils Emmerich <[email protected]> and
17+
reported by Julian Suleder via ERNW Vulnerability Disclosure.
18+
19+
Signed-off-by: Olivier Fourdan <[email protected]>
20+
Reviewed-by: Peter Hutterer <[email protected]>
21+
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
22+
---
23+
randr/rrproviderproperty.c | 3 ++-
24+
1 file changed, 2 insertions(+), 1 deletion(-)
25+
26+
diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c
27+
index 69f66ed278..0c3dcd1bc5 100644
28+
--- a/randr/rrproviderproperty.c
29+
+++ b/randr/rrproviderproperty.c
30+
@@ -182,7 +182,8 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
31+
32+
if (mode == PropModeReplace || len > 0) {
33+
void *new_data = NULL, *old_data = NULL;
34+
-
35+
+ if (total_len > MAXINT / size_in_bytes)
36+
+ return BadValue;
37+
total_size = total_len * size_in_bytes;
38+
new_value.data = (void *) malloc(total_size);
39+
if (!new_value.data && total_size) {
40+
--
41+
GitLab
42+

SPECS/xorg-x11-server-Xwayland/xorg-x11-server-Xwayland.spec

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Distribution: Azure Linux
1111
Summary: Xwayland
1212
Name: xorg-x11-server-Xwayland
1313
Version: 24.1.6
14-
Release: 1%{?dist}
14+
Release: 2%{?dist}
1515

1616
License: MIT
1717
URL: http://www.x.org
@@ -87,7 +87,13 @@ BuildRequires: pkgconfig(xcb-aux)
8787
BuildRequires: pkgconfig(xcb-image)
8888
BuildRequires: pkgconfig(xcb-keysyms)
8989
BuildRequires: pkgconfig(xcb-renderutil)
90-
90+
91+
Patch0: CVE-2025-49175.patch
92+
Patch1: CVE-2025-49177.patch
93+
Patch2: CVE-2025-49178.patch
94+
Patch3: CVE-2025-49179.patch
95+
Patch4: CVE-2025-49180.patch
96+
9197
%description
9298
Xwayland is an X server for running X clients under Wayland.
9399

@@ -137,6 +143,13 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
137143
%{_libdir}/pkgconfig/xwayland.pc
138144

139145
%changelog
146+
* Mon Jun 23 2025 Kevin Lockwood <[email protected]> - 24.1.6-2
147+
- Add patch for CVE-2025-49175
148+
- Add patch for CVE-2025-49177
149+
- Add patch for CVE-2025-49178
150+
- Add patch for CVE-2025-49179
151+
- Add patch for CVE-2025-49180
152+
140153
* Tue Mar 04 2025 CBL-Mariner Servicing Account <[email protected]> - 24.1.6-1
141154
- Auto-upgrade to 24.1.6 - to fix CVE-2025-26594, CVE-2025-26595, CVE-2025-26596, CVE-2025-26597, CVE-2025-26598, CVE-2025-26599, CVE-2025-26600, CVE-2025-26601[High]
142155
- Remove older applied patch for CVE-2024-9632

0 commit comments

Comments
 (0)