diff options
| author | Vijay Anusuri <vanusuri@mvista.com> | 2025-08-14 19:28:30 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-08-22 07:07:19 -0700 |
| commit | 372bb5d81edd9088316113bb0efefaf5346858e6 (patch) | |
| tree | 2146925158aeded70018bfb9652c7fd04d8fcdeb | |
| parent | 169ae15f95c39d83413b61b24e011bbd46ff1dd5 (diff) | |
| download | poky-372bb5d81edd9088316113bb0efefaf5346858e6.tar.gz | |
xserver-xorg: Fix for CVE-2025-49176
Upstream-Status: Backport from
https://gitlab.freedesktop.org/xorg/xserver/-/commit/03731b326a80b582e48d939fe62cb1e2b10400d9
& https://gitlab.freedesktop.org/xorg/xserver/-/commit/4fc4d76b2c7aaed61ed2653f997783a3714c4fe1
(From OE-Core rev: d1b634ce77b5d47b086a2c757acf50e6e002494b)
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
3 files changed, 131 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2025-49176-1.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2025-49176-1.patch new file mode 100644 index 0000000000..24c0156540 --- /dev/null +++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2025-49176-1.patch | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | From 03731b326a80b582e48d939fe62cb1e2b10400d9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Olivier Fourdan <ofourdan@redhat.com> | ||
| 3 | Date: Mon, 7 Apr 2025 16:13:34 +0200 | ||
| 4 | Subject: [PATCH] os: Do not overflow the integer size with BigRequest | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | The BigRequest extension allows requests larger than the 16-bit length | ||
| 10 | limit. | ||
| 11 | |||
| 12 | It uses integers for the request length and checks for the size not to | ||
| 13 | exceed the maxBigRequestSize limit, but does so after translating the | ||
| 14 | length to integer by multiplying the given size in bytes by 4. | ||
| 15 | |||
| 16 | In doing so, it might overflow the integer size limit before actually | ||
| 17 | checking for the overflow, defeating the purpose of the test. | ||
| 18 | |||
| 19 | To avoid the issue, make sure to check that the request size does not | ||
| 20 | overflow the maxBigRequestSize limit prior to any conversion. | ||
| 21 | |||
| 22 | The caller Dispatch() function however expects the return value to be in | ||
| 23 | bytes, so we cannot just return the converted value in case of error, as | ||
| 24 | that would also overflow the integer size. | ||
| 25 | |||
| 26 | To preserve the existing API, we use a negative value for the X11 error | ||
| 27 | code BadLength as the function only return positive values, 0 or -1 and | ||
| 28 | update the caller Dispatch() function to take that case into account to | ||
| 29 | return the error code to the offending client. | ||
| 30 | |||
| 31 | CVE-2025-49176 | ||
| 32 | |||
| 33 | This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and | ||
| 34 | reported by Julian Suleder via ERNW Vulnerability Disclosure. | ||
| 35 | |||
| 36 | Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> | ||
| 37 | Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> | ||
| 38 | Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024> | ||
| 39 | |||
| 40 | Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/03731b326a80b582e48d939fe62cb1e2b10400d9] | ||
| 41 | CVE: CVE-2025-49176 | ||
| 42 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
| 43 | --- | ||
| 44 | dix/dispatch.c | 9 +++++---- | ||
| 45 | os/io.c | 4 ++++ | ||
| 46 | 2 files changed, 9 insertions(+), 4 deletions(-) | ||
| 47 | |||
| 48 | diff --git a/dix/dispatch.c b/dix/dispatch.c | ||
| 49 | index b3e5feacc2..2308cfe6d1 100644 | ||
| 50 | --- a/dix/dispatch.c | ||
| 51 | +++ b/dix/dispatch.c | ||
| 52 | @@ -527,9 +527,10 @@ Dispatch(void) | ||
| 53 | |||
| 54 | /* now, finally, deal with client requests */ | ||
| 55 | result = ReadRequestFromClient(client); | ||
| 56 | - if (result <= 0) { | ||
| 57 | - if (result < 0) | ||
| 58 | - CloseDownClient(client); | ||
| 59 | + if (result == 0) | ||
| 60 | + break; | ||
| 61 | + else if (result == -1) { | ||
| 62 | + CloseDownClient(client); | ||
| 63 | break; | ||
| 64 | } | ||
| 65 | |||
| 66 | @@ -550,7 +551,7 @@ Dispatch(void) | ||
| 67 | client->index, | ||
| 68 | client->requestBuffer); | ||
| 69 | #endif | ||
| 70 | - if (result > (maxBigRequestSize << 2)) | ||
| 71 | + if (result < 0 || result > (maxBigRequestSize << 2)) | ||
| 72 | result = BadLength; | ||
| 73 | else { | ||
| 74 | result = XaceHookDispatch(client, client->majorOp); | ||
| 75 | diff --git a/os/io.c b/os/io.c | ||
| 76 | index 1fffaf62c7..3e39c10e6f 100644 | ||
| 77 | --- a/os/io.c | ||
| 78 | +++ b/os/io.c | ||
| 79 | @@ -300,6 +300,10 @@ ReadRequestFromClient(ClientPtr client) | ||
| 80 | needed = get_big_req_len(request, client); | ||
| 81 | } | ||
| 82 | client->req_len = needed; | ||
| 83 | + if (needed > MAXINT >> 2) { | ||
| 84 | + /* Check for potential integer overflow */ | ||
| 85 | + return -(BadLength); | ||
| 86 | + } | ||
| 87 | needed <<= 2; /* needed is in bytes now */ | ||
| 88 | } | ||
| 89 | if (gotnow < needed) { | ||
| 90 | -- | ||
| 91 | GitLab | ||
| 92 | |||
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2025-49176-2.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2025-49176-2.patch new file mode 100644 index 0000000000..6476af9a85 --- /dev/null +++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2025-49176-2.patch | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | From 4fc4d76b2c7aaed61ed2653f997783a3714c4fe1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Olivier Fourdan <ofourdan@redhat.com> | ||
| 3 | Date: Wed, 18 Jun 2025 08:39:02 +0200 | ||
| 4 | Subject: [PATCH] os: Check for integer overflow on BigRequest length | ||
| 5 | |||
| 6 | Check for another possible integer overflow once we get a complete xReq | ||
| 7 | with BigRequest. | ||
| 8 | |||
| 9 | Related to CVE-2025-49176 | ||
| 10 | |||
| 11 | Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> | ||
| 12 | Suggested-by: Peter Harris <pharris2@rocketsoftware.com> | ||
| 13 | Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2028> | ||
| 14 | |||
| 15 | Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/4fc4d76b2c7aaed61ed2653f997783a3714c4fe1] | ||
| 16 | CVE: CVE-2025-49176 #Follow-up Patch | ||
| 17 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> | ||
| 18 | --- | ||
| 19 | os/io.c | 2 ++ | ||
| 20 | 1 file changed, 2 insertions(+) | ||
| 21 | |||
| 22 | diff --git a/os/io.c b/os/io.c | ||
| 23 | index e7b76b9cea..167b40a720 100644 | ||
| 24 | --- a/os/io.c | ||
| 25 | +++ b/os/io.c | ||
| 26 | @@ -394,6 +394,8 @@ ReadRequestFromClient(ClientPtr client) | ||
| 27 | needed = get_big_req_len(request, client); | ||
| 28 | } | ||
| 29 | client->req_len = needed; | ||
| 30 | + if (needed > MAXINT >> 2) | ||
| 31 | + return -(BadLength); | ||
| 32 | needed <<= 2; | ||
| 33 | } | ||
| 34 | if (gotnow < needed) { | ||
| 35 | -- | ||
| 36 | GitLab | ||
| 37 | |||
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.8.bb b/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.8.bb index 565489a926..6013d0e53c 100644 --- a/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.8.bb +++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.8.bb | |||
| @@ -37,6 +37,8 @@ SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.pat | |||
| 37 | file://CVE-2025-26601-4.patch \ | 37 | file://CVE-2025-26601-4.patch \ |
| 38 | file://CVE-2022-49737.patch \ | 38 | file://CVE-2022-49737.patch \ |
| 39 | file://CVE-2025-49175.patch \ | 39 | file://CVE-2025-49175.patch \ |
| 40 | file://CVE-2025-49176-1.patch \ | ||
| 41 | file://CVE-2025-49176-2.patch \ | ||
| 40 | " | 42 | " |
| 41 | SRC_URI[sha256sum] = "38aadb735650c8024ee25211c190bf8aad844c5f59632761ab1ef4c4d5aeb152" | 43 | SRC_URI[sha256sum] = "38aadb735650c8024ee25211c190bf8aad844c5f59632761ab1ef4c4d5aeb152" |
| 42 | 44 | ||
