diff mbox series

[meta-oe,scarthgap,RFC,07/14] tigervnc: patch CVE-2025-26594

Message ID 20260127130116.1902238-8-skandigraun@gmail.com
State New
Headers show
Series TigerVNC CVEs | expand

Commit Message

Gyorgy Sarvari Jan. 27, 2026, 1:01 p.m. UTC
Details: https://nvd.nist.gov/vuln/detail/CVE-2025-26594

Pick the patch that explicitly references this vulnerability ID in
it message.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 .../tigervnc/files/CVE-2025-26594-1.patch     | 60 +++++++++++++++++++
 .../tigervnc/files/CVE-2025-26594-2.patch     | 53 ++++++++++++++++
 .../tigervnc/tigervnc_1.11.0.bb               |  2 +
 3 files changed, 115 insertions(+)
 create mode 100644 meta-oe/recipes-graphics/tigervnc/files/CVE-2025-26594-1.patch
 create mode 100644 meta-oe/recipes-graphics/tigervnc/files/CVE-2025-26594-2.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-graphics/tigervnc/files/CVE-2025-26594-1.patch b/meta-oe/recipes-graphics/tigervnc/files/CVE-2025-26594-1.patch
new file mode 100644
index 0000000000..e6786f4352
--- /dev/null
+++ b/meta-oe/recipes-graphics/tigervnc/files/CVE-2025-26594-1.patch
@@ -0,0 +1,60 @@ 
+From c5e22fddb236d0b5e452d9d535c51213d5231286 Mon Sep 17 00:00:00 2001
+From: Gyorgy Sarvari <skandigraun@gmail.com>
+Date: Wed, 27 Nov 2024 11:27:05 +0100
+Subject: [PATCH 1/2] Cursor: Refuse to free the root cursor
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Olivier Fourdan <ofourdan@redhat.com>
+
+If a cursor reference count drops to 0, the cursor is freed.
+
+The root cursor however is referenced with a specific global variable,
+and when the root cursor is freed, the global variable may still point
+to freed memory.
+
+Make sure to prevent the rootCursor from being explicitly freed by a
+client.
+
+CVE-2025-26594, ZDI-CAN-25544
+
+This vulnerability was discovered by:
+Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
+
+v2: Explicitly forbid XFreeCursor() on the root cursor (Peter Hutterer
+<peter.hutterer@who-t.net>)
+v3: Return BadCursor instead of BadValue (Michel Dänzer
+<michel@daenzer.net>)
+
+Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
+Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+(cherry picked from commit 01642f263f12becf803b19be4db95a4a83f94acc)
+
+Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1830>
+(cherry picked from commit 9e5ac777d0dfa9d4d78dd68558869489117c3f2c)
+
+CVE: CVE-2025-26594
+Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/9e5ac777d0dfa9d4d78dd68558869489117c3f2c]
+
+Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
+---
+ dix/dispatch.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/dix/dispatch.c b/dix/dispatch.c
+index a33bfaa9e..9654c207e 100644
+--- a/dix/dispatch.c
++++ b/dix/dispatch.c
+@@ -3039,6 +3039,10 @@ ProcFreeCursor(ClientPtr client)
+     rc = dixLookupResourceByType((void **) &pCursor, stuff->id, RT_CURSOR,
+                                  client, DixDestroyAccess);
+     if (rc == Success) {
++        if (pCursor == rootCursor) {
++            client->errorValue = stuff->id;
++            return BadCursor;
++        }
+         FreeResource(stuff->id, RT_NONE);
+         return Success;
+     }
diff --git a/meta-oe/recipes-graphics/tigervnc/files/CVE-2025-26594-2.patch b/meta-oe/recipes-graphics/tigervnc/files/CVE-2025-26594-2.patch
new file mode 100644
index 0000000000..7710d8c286
--- /dev/null
+++ b/meta-oe/recipes-graphics/tigervnc/files/CVE-2025-26594-2.patch
@@ -0,0 +1,53 @@ 
+From d6e2579da9987095b3909d8b2b239e7802cf1c2a Mon Sep 17 00:00:00 2001
+From: Gyorgy Sarvari <skandigraun@gmail.com>
+Date: Wed, 4 Dec 2024 15:49:43 +1000
+Subject: [PATCH 2/2] dix: keep a ref to the rootCursor
+
+From: Peter Hutterer <peter.hutterer@who-t.net>
+
+CreateCursor returns a cursor with refcount 1 - that refcount is used by
+the resource system, any caller needs to call RefCursor to get their own
+reference. That happens correctly for normal cursors but for our
+rootCursor we keep a variable to the cursor despite not having a ref for
+ourselves.
+
+Fix this by reffing/unreffing the rootCursor to ensure our pointer is
+valid.
+
+Related to CVE-2025-26594, ZDI-CAN-25544
+
+Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
+(cherry picked from commit b0a09ba6020147961acc62d9c73d807b4cccd9f7)
+
+Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1830>
+(cherry picked from commit 5f0c4e0bf254c8b4552da276d01b1b80881b4e26)
+
+CVE: CVE-2025-26594
+Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/5f0c4e0bf254c8b4552da276d01b1b80881b4e26]
+Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
+---
+ dix/main.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/dix/main.c b/dix/main.c
+index b228d9c28..f2606d3d6 100644
+--- a/dix/main.c
++++ b/dix/main.c
+@@ -235,6 +235,8 @@ dix_main(int argc, char *argv[], char *envp[])
+                        defaultCursorFont);
+         }
+ 
++        rootCursor = RefCursor(rootCursor);
++
+ #ifdef PANORAMIX
+         /*
+          * Consolidate window and colourmap information for each screen
+@@ -275,6 +277,8 @@ dix_main(int argc, char *argv[], char *envp[])
+ 
+         Dispatch();
+ 
++        UnrefCursor(rootCursor);
++
+         UndisplayDevices();
+         DisableAllDevices();
+ 
diff --git a/meta-oe/recipes-graphics/tigervnc/tigervnc_1.11.0.bb b/meta-oe/recipes-graphics/tigervnc/tigervnc_1.11.0.bb
index a007297012..3e657ea6a8 100644
--- a/meta-oe/recipes-graphics/tigervnc/tigervnc_1.11.0.bb
+++ b/meta-oe/recipes-graphics/tigervnc/tigervnc_1.11.0.bb
@@ -25,6 +25,8 @@  SRC_URI = "git://github.com/TigerVNC/tigervnc.git;branch=1.11-branch;protocol=ht
            file://CVE-2023-6478.patch;patchdir=${XORG_S} \
            file://CVE-2024-0408.patch;patchdir=${XORG_S} \
            file://CVE-2024-0409.patch;patchdir=${XORG_S} \
+           file://CVE-2025-26594-1.patch;patchdir=${XORG_S} \
+           file://CVE-2025-26594-2.patch;patchdir=${XORG_S} \
 "
 
 # Keep sync with xorg-server in oe-core