Other security related fixes
Resolves: https://redhat.atlassian.net/browse/RHEL-183890
This commit is contained in:
parent
3b045669f9
commit
c17e65776d
33 changed files with 1720 additions and 1 deletions
|
|
@ -0,0 +1,45 @@
|
|||
From e710e570b1709d100072a8ab7d05c2aefaf41a1b Mon Sep 17 00:00:00 2001
|
||||
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||
Date: Mon, 15 Jun 2026 14:00:19 +0200
|
||||
Subject: [PATCH xserver] dix: Silence a compiler warning in
|
||||
doListFontsAndAliases()
|
||||
|
||||
Compiler complains that "resolvedlen" might be uninitialized:
|
||||
|
||||
| dix/dixfonts.c:559:5: var_decl: Declaring variable "resolvedlen" without initializer.
|
||||
| dix/dixfonts.c:674:17: uninit_use: Using uninitialized value "resolvedlen".
|
||||
| 672| * is complete.
|
||||
| 673| */
|
||||
| 674|-> if (resolvedlen > XLFDMAXFONTNAMELEN) {
|
||||
| 675| err = BadFontName;
|
||||
| 676| goto ContBadFontName;
|
||||
|
||||
Most likely a false positive, while immediately after the (newly added)
|
||||
test, there was a memcpy() using "resolvedlen" and the compiler did not
|
||||
choke on that before.
|
||||
|
||||
Either way, initializing "resolvedlen" to 0 is a small price to pay to
|
||||
silence the compiler warning and keep us on the safe side.
|
||||
|
||||
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2237>
|
||||
---
|
||||
dix/dixfonts.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
|
||||
index 3c6c9d594..cf2b45d4f 100644
|
||||
--- a/dix/dixfonts.c
|
||||
+++ b/dix/dixfonts.c
|
||||
@@ -556,7 +556,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
|
||||
int err = Successful;
|
||||
FontNamesPtr names = NULL;
|
||||
char *name, *resolved = NULL;
|
||||
- int namelen, resolvedlen;
|
||||
+ int namelen, resolvedlen = 0;
|
||||
int nnames;
|
||||
int stringLens;
|
||||
int i;
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
From de771dee955914902ddc8e183fffb91446f36ace Mon Sep 17 00:00:00 2001
|
||||
From: Twaik Yont <9674930+twaik@users.noreply.github.com>
|
||||
Date: Thu, 10 Apr 2025 17:55:58 +0300
|
||||
Subject: [PATCH xserver 01/31] os: use close-on-exec for X server socket to
|
||||
prevent fd leaks
|
||||
|
||||
In most typical Linux X servers (like Xvfb, Xephyr, or Xwayland),
|
||||
no child process outlives the server, so this issue rarely arises.
|
||||
However, in embedded X servers (based on Xvfb or Kdrive) or in
|
||||
custom Xorg modules, the server might launch a long-running command
|
||||
with regular fork+exec calls. If the X server crashes or exits while
|
||||
that command is still running (for example, it spawns a tombstone
|
||||
generator or any process that hangs or turns to zombie), the file
|
||||
descriptor associated with the abstract socket can remain open in the
|
||||
child process. This leads to the kernel refusing to allow another X
|
||||
server to bind the same socket until the child process terminates
|
||||
(because there is no explicit way to unlink abstract socket, unlike
|
||||
Unix socket). By marking the file descriptor as close-on-exec, we
|
||||
ensure it is automatically closed in child processes, preserving the
|
||||
ability of a new X server process to bind the socket immediately.
|
||||
|
||||
Signed-off-by: Twaik Yont <9674930+twaik@users.noreply.github.com>
|
||||
(cherry picked from commit 5568b0f83f388a295f42d49411ced17387043794)
|
||||
(cherry picked from commit 59673c0503262b75791772af4c62120debebda61)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
os/connection.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/os/connection.c b/os/connection.c
|
||||
index 3223eeb5d..8a28df68e 100644
|
||||
--- a/os/connection.c
|
||||
+++ b/os/connection.c
|
||||
@@ -281,6 +281,7 @@ CreateWellKnownSockets(void)
|
||||
int fd = _XSERVTransGetConnectionNumber(ListenTransConns[i]);
|
||||
|
||||
ListenTransFds[i] = fd;
|
||||
+ _XSERVTransSetOption(ListenTransConns[i], TRANS_CLOSEONEXEC, 0);
|
||||
SetNotifyFd(fd, EstablishNewConnections, X_NOTIFY_READ, NULL);
|
||||
|
||||
if (!_XSERVTransIsLocal(ListenTransConns[i]))
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
From e3e933a06dc992b033968d5634c7d990d53737f5 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun, 10 Aug 2025 09:43:33 -0700
|
||||
Subject: [PATCH xserver 02/31] xf86bigfont: fix
|
||||
-Wimplicit-function-declaration error
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Build breaks with gcc 14 & later when xf86bigfont is enabled:
|
||||
|
||||
../Xext/xf86bigfont.c: In function ‘XFree86BigfontExtensionInit’:
|
||||
../Xext/xf86bigfont.c:709:28: error: implicit declaration of function
|
||||
‘xfont2_allocate_font_private_index’;
|
||||
did you mean ‘AllocateFontPrivateIndex’? [-Wimplicit-function-declaration]
|
||||
709 | FontShmdescIndex = xfont2_allocate_font_private_index();
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| AllocateFontPrivateIndex
|
||||
|
||||
Fixes: 05a793f5b ("dix: Switch to the libXfont2 API (v2)")
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 0617f6075b6a867c90912ccaf9de2200d06a5419)
|
||||
(cherry picked from commit 5a1fe4e4f12ccc6a91023bc6725209c2f8c28400)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
Xext/xf86bigfont.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
|
||||
index 44a8e7dd8..cf7d52fb8 100644
|
||||
--- a/Xext/xf86bigfont.c
|
||||
+++ b/Xext/xf86bigfont.c
|
||||
@@ -58,6 +58,10 @@
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
+#include <X11/extensions/xf86bigfproto.h>
|
||||
+#include <X11/fonts/fontstruct.h>
|
||||
+#include <X11/fonts/libxfont2.h>
|
||||
+
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
From 2ec131e3fa033ab2c70b46da961f6c3bcc3a4959 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Tue, 19 Aug 2025 18:52:16 -0700
|
||||
Subject: [PATCH xserver 03/31] dix: Fix builds with meson -Dxace=false
|
||||
-Dwerror=true
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
CI meson-disable-options builds were failing with:
|
||||
../dix/events.c: In function ‘CoreEnterLeaveEvent’:
|
||||
../dix/events.c:4723:19: error: unused variable ‘client’
|
||||
[-Werror=unused-variable]
|
||||
4723 | ClientPtr client = grab ? rClient(grab) : wClient(pWin);
|
||||
| ^~~~~~
|
||||
../dix/events.c: In function ‘CoreFocusEvent’:
|
||||
../dix/events.c:4834:19: error: unused variable ‘client’
|
||||
[-Werror=unused-variable]
|
||||
4834 | ClientPtr client = wClient(pWin);
|
||||
| ^~~~~~
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 6611caf828af4833d59cd41f8c64a910f1edcac9)
|
||||
(cherry picked from commit 878d73e31296f59fa70c9ac56508d51f140bb9ee)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
dix/events.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/dix/events.c b/dix/events.c
|
||||
index d21e1894c..8d8c4017b 100644
|
||||
--- a/dix/events.c
|
||||
+++ b/dix/events.c
|
||||
@@ -4735,7 +4735,9 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
|
||||
xKeymapEvent ke = {
|
||||
.type = KeymapNotify
|
||||
};
|
||||
+#ifdef XACE
|
||||
ClientPtr client = grab ? rClient(grab) : wClient(pWin);
|
||||
+#endif
|
||||
int rc;
|
||||
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
|
||||
@@ -4846,7 +4848,9 @@ CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
|
||||
xKeymapEvent ke = {
|
||||
.type = KeymapNotify
|
||||
};
|
||||
+#ifdef XACE
|
||||
ClientPtr client = wClient(pWin);
|
||||
+#endif
|
||||
int rc;
|
||||
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
|
||||
--
|
||||
2.54.0
|
||||
|
||||
43
0004-meson-don-t-build-xselinux-if-xace-is-disabled.patch
Normal file
43
0004-meson-don-t-build-xselinux-if-xace-is-disabled.patch
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
From 4ba490c26b027c704470f1159c95b9dadf3c0f0c Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Wed, 20 Aug 2025 10:58:39 -0700
|
||||
Subject: [PATCH xserver 04/31] meson: don't build xselinux if xace is disabled
|
||||
|
||||
xselinux requires xace to build
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 7b15321b3b0e40244af1488f4ee1cd4453a78bc8)
|
||||
(cherry picked from commit f468122d8df385ddac65022fcdbbf015896c22ad)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
meson.build | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 2e62f66a9..d48733938 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -452,7 +452,7 @@ if get_option('xselinux') != 'false'
|
||||
if get_option('xselinux') == 'true'
|
||||
build_xselinux = true
|
||||
else
|
||||
- build_xselinux = dep_selinux.found() and dep_audit.found()
|
||||
+ build_xselinux = dep_selinux.found() and dep_audit.found() and build_xace
|
||||
endif
|
||||
|
||||
if build_xselinux
|
||||
@@ -460,6 +460,10 @@ if get_option('xselinux') != 'false'
|
||||
common_dep += dep_audit
|
||||
endif
|
||||
endif
|
||||
+if build_xselinux and not build_xace
|
||||
+ error('cannot build SELinux extension without X-ACE')
|
||||
+endif
|
||||
+
|
||||
|
||||
socket_dep = []
|
||||
if host_machine.system() == 'windows'
|
||||
--
|
||||
2.54.0
|
||||
|
||||
86
0005-xwayland-fix-builds-with-xace-disabled.patch
Normal file
86
0005-xwayland-fix-builds-with-xace-disabled.patch
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
From 5feedb15a5ed819b9fc09f271ff7a3cc9a00a810 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Wed, 20 Aug 2025 13:15:17 -0700
|
||||
Subject: [PATCH xserver 05/31] xwayland: fix builds with xace disabled
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
CI meson-disable-options builds were failing with:
|
||||
../hw/xwayland/xwayland-screen.c: In function ‘xwl_close_screen’:
|
||||
../hw/xwayland/xwayland-screen.c:246:5: error: implicit declaration of
|
||||
function ‘XaceDeleteCallback’; did you mean ‘DeleteCallback’?
|
||||
[-Werror=implicit-function-declaration]
|
||||
246 | XaceDeleteCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, screen);
|
||||
| ^~~~~~~~~~~~~~~~~~
|
||||
| DeleteCallback
|
||||
|
||||
../hw/xwayland/xwayland-screen.c:246:24: error: ‘XACE_PROPERTY_ACCESS’
|
||||
undeclared (first use in this function)
|
||||
246 | XaceDeleteCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, screen);
|
||||
| ^~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
../hw/xwayland/xwayland-screen.c: In function ‘xwl_screen_init’:
|
||||
../hw/xwayland/xwayland-screen.c:1174:5: error: implicit declaration of
|
||||
function ‘XaceRegisterCallback’ [-Werror=implicit-function-declaration]
|
||||
1174 | XaceRegisterCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, pScreen);
|
||||
| ^~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
../hw/xwayland/xwayland-screen.c:1174:26: error: ‘XACE_PROPERTY_ACCESS’
|
||||
undeclared (first use in this function)
|
||||
1174 | XaceRegisterCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, pScreen);
|
||||
| ^~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Fixes: a07c2cda9 ("xwayland: Add an XACE property access handler")
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 48acd1ae7835c2e95c7f2db704b1f22dcba4efdd)
|
||||
(cherry picked from commit 3298b0a3e021efc99e4a7892ce4b176bc5e7d556)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
hw/xwayland/xwayland-screen.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
|
||||
index 7ab9174ec..c83adda9f 100644
|
||||
--- a/hw/xwayland/xwayland-screen.c
|
||||
+++ b/hw/xwayland/xwayland-screen.c
|
||||
@@ -181,6 +181,7 @@ xwl_property_callback(CallbackListPtr *pcbl, void *closure,
|
||||
xwl_window_update_property(xwl_window, rec);
|
||||
}
|
||||
|
||||
+#ifdef XACE
|
||||
#define readOnlyPropertyAccessMask (DixReadAccess |\
|
||||
DixGetAttrAccess |\
|
||||
DixListPropAccess |\
|
||||
@@ -207,6 +208,7 @@ xwl_access_property_callback(CallbackListPtr *pcbl, void *closure,
|
||||
}
|
||||
|
||||
#undef readOnlyPropertyAccessMask
|
||||
+#endif /* XACE */
|
||||
|
||||
static void
|
||||
xwl_root_window_finalized_callback(CallbackListPtr *pcbl,
|
||||
@@ -237,7 +239,9 @@ xwl_close_screen(ScreenPtr screen)
|
||||
xwl_dmabuf_feedback_destroy(&xwl_screen->default_feedback);
|
||||
#endif
|
||||
DeleteCallback(&PropertyStateCallback, xwl_property_callback, screen);
|
||||
+#ifdef XACE
|
||||
XaceDeleteCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, screen);
|
||||
+#endif
|
||||
|
||||
xorg_list_for_each_entry_safe(xwl_output, next_xwl_output,
|
||||
&xwl_screen->output_list, link)
|
||||
@@ -1168,7 +1172,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
||||
|
||||
AddCallback(&PropertyStateCallback, xwl_property_callback, pScreen);
|
||||
AddCallback(&RootWindowFinalizeCallback, xwl_root_window_finalized_callback, pScreen);
|
||||
+#ifdef XACE
|
||||
XaceRegisterCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, pScreen);
|
||||
+#endif
|
||||
|
||||
xwl_screen_setup_custom_vector(xwl_screen);
|
||||
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
From 4aaeda4cbfe4c1d3e3ca7166aac88679325ec560 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sat, 20 Sep 2025 16:35:46 -0700
|
||||
Subject: [PATCH xserver 06/31] panoramix: avoid null dereference in
|
||||
PanoramiXMaybeAddDepth()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Reported in #1817:
|
||||
|
||||
Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:748:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘PanoramiXDepths’
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:802:1: enter_function: entry to ‘PanoramiXConsolidate’
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:813:17: branch_true: following ‘true’ branch...
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:814:9: branch_true: ...to here
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:814:9: call_function: calling ‘PanoramiXMaybeAddDepth’ from ‘PanoramiXConsolidate’
|
||||
746| PanoramiXDepths = reallocarray(PanoramiXDepths,
|
||||
747| PanoramiXNumDepths, sizeof(DepthRec));
|
||||
748|-> PanoramiXDepths[j].depth = pDepth->depth;
|
||||
749| PanoramiXDepths[j].numVids = 0;
|
||||
750| PanoramiXDepths[j].vids = NULL;
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 537b56cccaf1759f9beef9396463b1f412614003)
|
||||
(cherry picked from commit 9664b5532480ddb739e414e74e933691bbe36e85)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
Xext/panoramiX.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
|
||||
index 71713f14b..c6d0e5183 100644
|
||||
--- a/Xext/panoramiX.c
|
||||
+++ b/Xext/panoramiX.c
|
||||
@@ -743,8 +743,8 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
|
||||
|
||||
j = PanoramiXNumDepths;
|
||||
PanoramiXNumDepths++;
|
||||
- PanoramiXDepths = reallocarray(PanoramiXDepths,
|
||||
- PanoramiXNumDepths, sizeof(DepthRec));
|
||||
+ PanoramiXDepths = XNFreallocarray(PanoramiXDepths,
|
||||
+ PanoramiXNumDepths, sizeof(DepthRec));
|
||||
PanoramiXDepths[j].depth = pDepth->depth;
|
||||
PanoramiXDepths[j].numVids = 0;
|
||||
PanoramiXDepths[j].vids = NULL;
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
From ccd2a541458a844397757cebade4970173471a30 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sat, 20 Sep 2025 16:45:59 -0700
|
||||
Subject: [PATCH xserver 07/31] panoramix: avoid null dereference in
|
||||
PanoramiXConsolidate()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Reported in #1817:
|
||||
|
||||
Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:820:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘root’
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:819:12: acquire_memory: this call could return NULL
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:820:5: danger: ‘root’ could be NULL: unchecked value from (1)
|
||||
818|
|
||||
819| root = malloc(sizeof(PanoramiXRes));
|
||||
820|-> root->type = XRT_WINDOW;
|
||||
821| defmap = malloc(sizeof(PanoramiXRes));
|
||||
822| defmap->type = XRT_COLORMAP;
|
||||
Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
|
||||
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:822:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘defmap’
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:821:14: acquire_memory: this call could return NULL
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:822:5: danger: ‘defmap’ could be NULL: unchecked value from (1)
|
||||
820| root->type = XRT_WINDOW;
|
||||
821| defmap = malloc(sizeof(PanoramiXRes));
|
||||
822|-> defmap->type = XRT_COLORMAP;
|
||||
823| saver = malloc(sizeof(PanoramiXRes));
|
||||
824| saver->type = XRT_WINDOW;
|
||||
|
||||
Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:824:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘saver’
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:823:13: acquire_memory: this call could return NULL
|
||||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:824:5: danger: ‘saver’ could be NULL: unchecked value from (1)
|
||||
822| defmap->type = XRT_COLORMAP;
|
||||
823| saver = malloc(sizeof(PanoramiXRes));
|
||||
824|-> saver->type = XRT_WINDOW;
|
||||
825|
|
||||
826| FOR_NSCREENS(i) {
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 23c103d41f35cc030b0c0e973f7f3bcb8d9902a0)
|
||||
(cherry picked from commit 6edd79e5f50df456c7dccc693188229684d8f55f)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
Xext/panoramiX.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
|
||||
index c6d0e5183..cea919bf0 100644
|
||||
--- a/Xext/panoramiX.c
|
||||
+++ b/Xext/panoramiX.c
|
||||
@@ -816,11 +816,11 @@ PanoramiXConsolidate(void)
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
PanoramiXMaybeAddVisual(pVisual++);
|
||||
|
||||
- root = malloc(sizeof(PanoramiXRes));
|
||||
+ root = XNFcallocarray(1, sizeof(PanoramiXRes));
|
||||
root->type = XRT_WINDOW;
|
||||
- defmap = malloc(sizeof(PanoramiXRes));
|
||||
+ defmap = XNFcallocarray(1, sizeof(PanoramiXRes));
|
||||
defmap->type = XRT_COLORMAP;
|
||||
- saver = malloc(sizeof(PanoramiXRes));
|
||||
+ saver = XNFcallocarray(1, sizeof(PanoramiXRes));
|
||||
saver->type = XRT_WINDOW;
|
||||
|
||||
FOR_NSCREENS(i) {
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
From 7280a8d92738f048d4ccfda19effab9f0bdec492 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sat, 25 Oct 2025 15:33:40 -0700
|
||||
Subject: [PATCH xserver 08/31] glamor: handle potential NULL return from
|
||||
GetPictureScreenIfSet()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Unlike GetPictureScreen(), GetPictureScreenIfSet() checks if the
|
||||
private key is registered, and returns NULL if it is not.
|
||||
|
||||
Reported in #1817:
|
||||
xwayland-24.1.6/redhat-linux-build/../glamor/glamor.c:926:5:
|
||||
warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ps’
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 69b48423bd66f04bac8a633004ebc8e6e691756f)
|
||||
(cherry picked from commit 394cb2d824df5fa481279173357a4ad1c759ceec)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
glamor/glamor.c | 38 +++++++++++++++++++++-----------------
|
||||
1 file changed, 21 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/glamor/glamor.c b/glamor/glamor.c
|
||||
index 70a34d81b..7c88d7e18 100644
|
||||
--- a/glamor/glamor.c
|
||||
+++ b/glamor/glamor.c
|
||||
@@ -840,23 +840,25 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
||||
glamor_priv->saved_procs.bitmap_to_region = screen->BitmapToRegion;
|
||||
screen->BitmapToRegion = glamor_bitmap_to_region;
|
||||
|
||||
- glamor_priv->saved_procs.composite = ps->Composite;
|
||||
- ps->Composite = glamor_composite;
|
||||
+ if (ps) {
|
||||
+ glamor_priv->saved_procs.composite = ps->Composite;
|
||||
+ ps->Composite = glamor_composite;
|
||||
|
||||
- glamor_priv->saved_procs.trapezoids = ps->Trapezoids;
|
||||
- ps->Trapezoids = glamor_trapezoids;
|
||||
+ glamor_priv->saved_procs.trapezoids = ps->Trapezoids;
|
||||
+ ps->Trapezoids = glamor_trapezoids;
|
||||
|
||||
- glamor_priv->saved_procs.triangles = ps->Triangles;
|
||||
- ps->Triangles = glamor_triangles;
|
||||
+ glamor_priv->saved_procs.triangles = ps->Triangles;
|
||||
+ ps->Triangles = glamor_triangles;
|
||||
|
||||
- glamor_priv->saved_procs.addtraps = ps->AddTraps;
|
||||
- ps->AddTraps = glamor_add_traps;
|
||||
+ glamor_priv->saved_procs.addtraps = ps->AddTraps;
|
||||
+ ps->AddTraps = glamor_add_traps;
|
||||
|
||||
- glamor_priv->saved_procs.composite_rects = ps->CompositeRects;
|
||||
- ps->CompositeRects = glamor_composite_rectangles;
|
||||
+ glamor_priv->saved_procs.composite_rects = ps->CompositeRects;
|
||||
+ ps->CompositeRects = glamor_composite_rectangles;
|
||||
|
||||
- glamor_priv->saved_procs.glyphs = ps->Glyphs;
|
||||
- ps->Glyphs = glamor_composite_glyphs;
|
||||
+ glamor_priv->saved_procs.glyphs = ps->Glyphs;
|
||||
+ ps->Glyphs = glamor_composite_glyphs;
|
||||
+ }
|
||||
|
||||
glamor_init_vbo(screen);
|
||||
|
||||
@@ -923,11 +925,13 @@ glamor_close_screen(ScreenPtr screen)
|
||||
screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region;
|
||||
screen->BlockHandler = glamor_priv->saved_procs.block_handler;
|
||||
|
||||
- ps->Composite = glamor_priv->saved_procs.composite;
|
||||
- ps->Trapezoids = glamor_priv->saved_procs.trapezoids;
|
||||
- ps->Triangles = glamor_priv->saved_procs.triangles;
|
||||
- ps->CompositeRects = glamor_priv->saved_procs.composite_rects;
|
||||
- ps->Glyphs = glamor_priv->saved_procs.glyphs;
|
||||
+ if (ps) {
|
||||
+ ps->Composite = glamor_priv->saved_procs.composite;
|
||||
+ ps->Trapezoids = glamor_priv->saved_procs.trapezoids;
|
||||
+ ps->Triangles = glamor_priv->saved_procs.triangles;
|
||||
+ ps->CompositeRects = glamor_priv->saved_procs.composite_rects;
|
||||
+ ps->Glyphs = glamor_priv->saved_procs.glyphs;
|
||||
+ }
|
||||
|
||||
screen_pixmap = screen->GetScreenPixmap(screen);
|
||||
glamor_pixmap_destroy_fbo(screen_pixmap);
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
From e0fc4404a165a8262a86cec6305108b76a3c7a5c Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sat, 25 Oct 2025 16:27:34 -0700
|
||||
Subject: [PATCH xserver 09/31] glamor: handle allocation failure in
|
||||
glamor_create_pixmap()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Reported by gcc 15.1:
|
||||
|
||||
../glamor/glamor.c: In function ‘glamor_create_pixmap’:
|
||||
../glamor/glamor.c:233:23: warning: potential null pointer dereference
|
||||
[-Wnull-dereference]
|
||||
233 | pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
|
||||
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
|
||||
../glamor/glamor.c:228:26: warning: potential null pointer dereference
|
||||
[-Wnull-dereference]
|
||||
228 | pixmap_priv->is_cbcr = (GLAMOR_CREATE_FORMAT_CBCR & usage) == GLAMOR_CREATE_FORMAT_CBCR;
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit cc647f23679ae2beb7b971aa7d1203375c25bb55)
|
||||
(cherry picked from commit 3611931eb3cec6e89df298bebab88beac89644aa)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
glamor/glamor.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/glamor/glamor.c b/glamor/glamor.c
|
||||
index 7c88d7e18..b2bd34f39 100644
|
||||
--- a/glamor/glamor.c
|
||||
+++ b/glamor/glamor.c
|
||||
@@ -223,6 +223,9 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||||
else
|
||||
pixmap = fbCreatePixmap(screen, 0, 0, depth, usage);
|
||||
|
||||
+ if (!pixmap)
|
||||
+ return NullPixmap;
|
||||
+
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
pixmap_priv->is_cbcr = (GLAMOR_CREATE_FORMAT_CBCR & usage) == GLAMOR_CREATE_FORMAT_CBCR;
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
From c3507c99d9466d189b03d9ef1e9957a651441be6 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun, 26 Oct 2025 12:56:13 -0700
|
||||
Subject: [PATCH xserver 10/31] glamor: silence false positive in
|
||||
glamor_validate_gc()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
We know that if gc->tileIsPixel is false, then gc->tile.pixmap must be
|
||||
a valid pixmap, but gcc's static analyzer doesn't and needs to be told.
|
||||
|
||||
Silences false positive reported in #1817:
|
||||
|
||||
xwayland-24.1.6/redhat-linux-build/../glamor/glamor_core.c:205:19:
|
||||
warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit a79bdc495eaabd770cec03badd74c3b023877ba1)
|
||||
(cherry picked from commit 03b40ee38d58285063c7ed22998a390422109f13)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
glamor/glamor_core.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
|
||||
index 9a7510da0..8a601d086 100644
|
||||
--- a/glamor/glamor_core.c
|
||||
+++ b/glamor/glamor_core.c
|
||||
@@ -200,6 +200,8 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
|
||||
*/
|
||||
if (changes & GCTile) {
|
||||
if (!gc->tileIsPixel) {
|
||||
+ assert(gc->tile.pixmap != NullPixmap);
|
||||
+
|
||||
glamor_pixmap_private *pixmap_priv =
|
||||
glamor_get_pixmap_private(gc->tile.pixmap);
|
||||
if ((!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
From 9b14c2bfd41a4c9a6b29eac91a4ab1ddbe782f5e Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun, 26 Oct 2025 15:39:47 -0700
|
||||
Subject: [PATCH xserver 11/31] glamor: handle allocation failures in
|
||||
glamor_largepixmap.c
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Reported in #1817:
|
||||
|
||||
xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:130:17:
|
||||
warning[-Wanalyzer-possible-null-dereference]:
|
||||
dereference of possibly-NULL ‘clipped_regions’
|
||||
|
||||
xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:235:13:
|
||||
warning[-Wanalyzer-possible-null-dereference]:
|
||||
dereference of possibly-NULL ‘result_regions’
|
||||
|
||||
xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:365:9:
|
||||
warning[-Wanalyzer-possible-null-dereference]:
|
||||
dereference of possibly-NULL ‘clipped_regions’
|
||||
|
||||
xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:1175:9:
|
||||
warning[-Wanalyzer-possible-null-dereference]:
|
||||
dereference of possibly-NULL ‘source_pixmap_priv’
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 84cf20e6ddacbfc62637f156a92d673574c43604)
|
||||
(cherry picked from commit cdc7efe75f45b4c5fa3a9aa06c3a616d70b63b30)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
glamor/glamor_largepixmap.c | 23 +++++++++++++++++++----
|
||||
1 file changed, 19 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/glamor/glamor_largepixmap.c b/glamor/glamor_largepixmap.c
|
||||
index 57760f8d3..334a20cb1 100644
|
||||
--- a/glamor/glamor_largepixmap.c
|
||||
+++ b/glamor/glamor_largepixmap.c
|
||||
@@ -77,6 +77,10 @@ __glamor_compute_clipped_regions(int block_w,
|
||||
clipped_regions = calloc((end_block_x - start_block_x + 1)
|
||||
* (end_block_y - start_block_y + 1),
|
||||
sizeof(*clipped_regions));
|
||||
+ if (clipped_regions == NULL) {
|
||||
+ *n_region = 0;
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
DEBUGF("startx %d starty %d endx %d endy %d \n",
|
||||
start_x, start_y, end_x, end_y);
|
||||
@@ -216,6 +220,11 @@ glamor_compute_clipped_regions_ext(PixmapPtr pixmap,
|
||||
inner_block_w)
|
||||
* ((block_h + inner_block_h - 1) /
|
||||
inner_block_h), sizeof(*result_regions));
|
||||
+ if (result_regions == NULL) {
|
||||
+ *n_region = 0;
|
||||
+ free(clipped_regions);
|
||||
+ return NULL;
|
||||
+ }
|
||||
k = 0;
|
||||
for (i = 0; i < *n_region; i++) {
|
||||
x = box_array[clipped_regions[i].block_idx].x1;
|
||||
@@ -362,10 +371,14 @@ _glamor_compute_clipped_regions(PixmapPtr pixmap,
|
||||
DEBUGRegionPrint(region);
|
||||
if (glamor_pixmap_priv_is_small(pixmap_priv)) {
|
||||
clipped_regions = calloc(1, sizeof(*clipped_regions));
|
||||
- clipped_regions[0].region = RegionCreate(NULL, 1);
|
||||
- clipped_regions[0].block_idx = 0;
|
||||
- RegionCopy(clipped_regions[0].region, region);
|
||||
- *n_region = 1;
|
||||
+ if (clipped_regions) {
|
||||
+ clipped_regions[0].region = RegionCreate(NULL, 1);
|
||||
+ clipped_regions[0].block_idx = 0;
|
||||
+ RegionCopy(clipped_regions[0].region, region);
|
||||
+ *n_region = 1;
|
||||
+ }
|
||||
+ else
|
||||
+ *n_region = 0;
|
||||
return clipped_regions;
|
||||
}
|
||||
|
||||
@@ -1172,6 +1185,8 @@ glamor_composite_largepixmap_region(CARD8 op,
|
||||
/* XXX self-copy... */
|
||||
need_free_source_pixmap_priv = source_pixmap_priv;
|
||||
source_pixmap_priv = malloc(sizeof(*source_pixmap_priv));
|
||||
+ if (source_pixmap_priv == NULL)
|
||||
+ return FALSE;
|
||||
*source_pixmap_priv = *need_free_source_pixmap_priv;
|
||||
need_free_source_pixmap_priv = source_pixmap_priv;
|
||||
}
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From 0ef7c3716d9373617acd26bc5249cf5ed15a1dab Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Tue, 28 Oct 2025 18:16:00 -0700
|
||||
Subject: [PATCH xserver 12/31] glamor: avoid null dereference in
|
||||
glamor_dash_setup()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Reported in #1817:
|
||||
|
||||
xwayland-24.1.6/redhat-linux-build/../glamor/glamor_dash.c:152:10:
|
||||
warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit c6522229b86f9087347b17280b6e5f19345baf9a)
|
||||
(cherry picked from commit 84dccbc45a5cbc6fe4583cc946460c12c749ec70)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
glamor/glamor_dash.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/glamor/glamor_dash.c b/glamor/glamor_dash.c
|
||||
index 828969d91..74252de33 100644
|
||||
--- a/glamor/glamor_dash.c
|
||||
+++ b/glamor/glamor_dash.c
|
||||
@@ -149,7 +149,7 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
|
||||
dash_pixmap = glamor_get_dash_pixmap(gc);
|
||||
dash_priv = glamor_get_pixmap_private(dash_pixmap);
|
||||
|
||||
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dash_priv))
|
||||
+ if (!dash_priv || !GLAMOR_PIXMAP_PRIV_HAS_FBO(dash_priv))
|
||||
goto bail;
|
||||
|
||||
glamor_make_current(glamor_priv);
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From 419f81c69396e5ccf84d43acb42eb788447b1f19 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun, 2 Nov 2025 11:23:37 -0800
|
||||
Subject: [PATCH xserver 13/31] glamor: avoid null dereference in
|
||||
glamor_composite_clipped_region()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Reported in #1817:
|
||||
|
||||
xwayland-24.1.6/redhat-linux-build/../glamor/glamor_render.c:1577:21:
|
||||
warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 6a4ec30af49bcbf61cf8ebc3a8f5541abac9024d)
|
||||
(cherry picked from commit 2df83c556674c1cc855b5a8df29ab46cc8581d4f)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
glamor/glamor_render.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
|
||||
index 1bcf01102..1208b49a7 100644
|
||||
--- a/glamor/glamor_render.c
|
||||
+++ b/glamor/glamor_render.c
|
||||
@@ -1573,7 +1573,7 @@ glamor_composite_clipped_region(CARD8 op,
|
||||
if (source
|
||||
&& ((!source->pDrawable
|
||||
&& (source->pSourcePict->type != SourcePictTypeSolidFill))
|
||||
- || (source->pDrawable
|
||||
+ || (source->pDrawable && source_pixmap
|
||||
&& !GLAMOR_PIXMAP_PRIV_HAS_FBO(source_pixmap_priv)
|
||||
&& (source_pixmap->drawable.width != width
|
||||
|| source_pixmap->drawable.height != height)))) {
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
From eafb70502722a5ec61ae34f2ed1d18830f00d491 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun, 2 Nov 2025 12:16:56 -0800
|
||||
Subject: [PATCH xserver 14/31] glamor: avoid double free in
|
||||
glamor_make_pixmap_exportable()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Reported by gcc 15.1:
|
||||
|
||||
../glamor/glamor_egl.c:320:9:
|
||||
warning: double-‘free’ of ‘modifiers’ [CWE-415] [-Wanalyzer-double-free]
|
||||
[...]
|
||||
│ 732 |│ free(*modifiers);
|
||||
│ |│ ~~~~~~~~~~~~~~~~
|
||||
│ |│ |
|
||||
│ |└───────>(25) ...to here
|
||||
│ | (26) first ‘free’ here
|
||||
[...]
|
||||
│ 320 | free(modifiers);
|
||||
│ | ~~~~~~~~~~~~~~~
|
||||
│ | |
|
||||
│ | (28) ⚠️ second ‘free’ here; first ‘free’ was at (26)
|
||||
|
||||
Fixes: cef12efc1 ("glamor: Implement GetSupportedModifiers")
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 3e9baa20f39b0502efdaf48c2ca7e2f58d1e3120)
|
||||
(cherry picked from commit 46ad1628150724562b9c95b81347aa32b223d300)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
glamor/glamor_egl.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
|
||||
index 136033a9a..87da35a2c 100644
|
||||
--- a/glamor/glamor_egl.c
|
||||
+++ b/glamor/glamor_egl.c
|
||||
@@ -730,6 +730,7 @@ glamor_get_modifiers(ScreenPtr screen, uint32_t format,
|
||||
if (!eglQueryDmaBufModifiersEXT(glamor_egl->display, format, num,
|
||||
(EGLuint64KHR *) *modifiers, NULL, &num)) {
|
||||
free(*modifiers);
|
||||
+ *modifiers = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
--
|
||||
2.54.0
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
From d0aed694f38cea740d41ce34e1cec97e5ac1e854 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sun, 7 Dec 2025 15:57:53 -0800
|
||||
Subject: [PATCH xserver 15/31] dix: set errorValue correctly when XID lookup
|
||||
fails in ChangeGCXIDs()
|
||||
|
||||
dixLookupResourceByType always overwrites the pointer passed in as the
|
||||
first arg, so we shouldn't use the union it's in after that to get the
|
||||
requested XID value to put in the errorValue.
|
||||
|
||||
Closes: #1857
|
||||
Fixes: 2d7eb4a19 ("Pre-validate ChangeGC XIDs.")
|
||||
Reported-by: Mouse <mouse@Rodents-Montreal.ORG>
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit ac42c39145849588544ad10812e5a8ae76bf1114)
|
||||
(cherry picked from commit 7f1050de78239daa643483f719ba9cecdf427265)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
dix/gc.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dix/gc.c b/dix/gc.c
|
||||
index 47bab00bd..43244895a 100644
|
||||
--- a/dix/gc.c
|
||||
+++ b/dix/gc.c
|
||||
@@ -441,6 +441,7 @@ ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32)
|
||||
vals[i].val = pC32[i];
|
||||
for (i = 0; i < ARRAY_SIZE(xidfields); ++i) {
|
||||
int offset, rc;
|
||||
+ XID id;
|
||||
|
||||
if (!(mask & xidfields[i].mask))
|
||||
continue;
|
||||
@@ -449,11 +450,13 @@ ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32)
|
||||
vals[offset].ptr = NullPixmap;
|
||||
continue;
|
||||
}
|
||||
- rc = dixLookupResourceByType(&vals[offset].ptr, vals[offset].val,
|
||||
+ /* save the id, since dixLookupResourceByType overwrites &vals[offset] */
|
||||
+ id = vals[offset].val;
|
||||
+ rc = dixLookupResourceByType(&vals[offset].ptr, id,
|
||||
xidfields[i].type, client,
|
||||
xidfields[i].access_mode);
|
||||
if (rc != Success) {
|
||||
- client->errorValue = vals[offset].val;
|
||||
+ client->errorValue = id;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.54.0
|
||||
|
||||
41
0016-os-avoid-closing-null-fd-at-Fopen.patch
Normal file
41
0016-os-avoid-closing-null-fd-at-Fopen.patch
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
From b72fcbeb0a5764a5bdee002a08d3ff4e8a96f737 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
|
||||
Date: Wed, 17 Dec 2025 11:52:16 +0300
|
||||
Subject: [PATCH xserver 16/31] os: avoid closing null fd at Fopen
|
||||
|
||||
In `Fopen` function variable `iop` may store NULL as a result of `fopen`
|
||||
call. In this case, if later privileges couldn't be restored (`seteuid`
|
||||
call fails), further `fclose(iop)` call will cause runtime error.
|
||||
|
||||
This commit adds check `iop` for NULL before calling `fclose` to prevent
|
||||
potential NULL pointer dereference.
|
||||
|
||||
Found by Linux Verification Center (linuxtesting.org) with SVACE.
|
||||
|
||||
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
|
||||
(cherry picked from commit f83807647e171def9244a7f1d8d9af8e8e79f847)
|
||||
(cherry picked from commit dd2255c309ca8912e33c2f445c636f987e2b2088)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
os/utils.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/os/utils.c b/os/utils.c
|
||||
index df56b5b9b..c1e280b35 100644
|
||||
--- a/os/utils.c
|
||||
+++ b/os/utils.c
|
||||
@@ -1406,7 +1406,9 @@ Fopen(const char *file, const char *type)
|
||||
iop = fopen(file, type);
|
||||
|
||||
if (seteuid(euid) == -1) {
|
||||
- fclose(iop);
|
||||
+ if (iop) {
|
||||
+ fclose(iop);
|
||||
+ }
|
||||
return NULL;
|
||||
}
|
||||
return iop;
|
||||
--
|
||||
2.54.0
|
||||
|
||||
49
0017-os-make-FormatInt64-handle-LONG_MIN-correctly.patch
Normal file
49
0017-os-make-FormatInt64-handle-LONG_MIN-correctly.patch
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
From b1c4967e1909b5ba507fd7198fff669b9e759e80 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Fri, 19 Dec 2025 17:10:43 -0800
|
||||
Subject: [PATCH xserver 17/31] os: make FormatInt64() handle LONG_MIN
|
||||
correctly
|
||||
|
||||
When compiling with gcc 15.2.0 using -O3 -m64 on Solaris SPARC & x64,
|
||||
we'd get a test failure of:
|
||||
|
||||
Assertion failed: strcmp(logmsg, expected) == 0,
|
||||
file ../test/signal-logging.c, line 339, function logging_format
|
||||
|
||||
because 'num *= 1' produced a value that was out of the range of the
|
||||
int64_t it was being stored in. (Compiling with -O2 worked fine with
|
||||
the same compiler/configuration/platform though.)
|
||||
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
(cherry picked from commit 7f68b588657ea14050971efa86682e55e2c7e21b)
|
||||
(cherry picked from commit 3eac9393d734a1aa8342179f98e30569da70db95)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
os/fmt.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/os/fmt.c b/os/fmt.c
|
||||
index c5c61bdba..7bda7014a 100644
|
||||
--- a/os/fmt.c
|
||||
+++ b/os/fmt.c
|
||||
@@ -16,12 +16,14 @@
|
||||
void
|
||||
FormatInt64(int64_t num, char *string)
|
||||
{
|
||||
+ uint64_t unum = num;
|
||||
+
|
||||
if (num < 0) {
|
||||
string[0] = '-';
|
||||
- num *= -1;
|
||||
+ unum = num * -1;
|
||||
string++;
|
||||
}
|
||||
- FormatUInt64(num, string);
|
||||
+ FormatUInt64(unum, string);
|
||||
}
|
||||
|
||||
/* Format a number into a string in a signal safe manner. The string should be
|
||||
--
|
||||
2.54.0
|
||||
|
||||
61
0018-xwayland-wrong-expecting_event.patch
Normal file
61
0018-xwayland-wrong-expecting_event.patch
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
From b0b157607016b45848a714aea31586f6e9a3927b Mon Sep 17 00:00:00 2001
|
||||
From: Yixue Wang <yixue.wang@outlook.com>
|
||||
Date: Wed, 28 Jan 2026 16:11:23 +0800
|
||||
Subject: [PATCH xserver 18/31] xwayland: wrong expecting_event
|
||||
|
||||
According to
|
||||
|
||||
https://wayland.app/protocols/wayland#wl_seat:event:capabilities
|
||||
|
||||
Compositor might send capabilities when its capabilities change.
|
||||
Decrease expecting_event here without any check might cause a
|
||||
negative expecting_count.
|
||||
|
||||
(cherry picked from commit 6bf6a9bff293fc1b26024d27d444829c945d3f0e)
|
||||
(cherry picked from commit 6a37e21ca4bd650568a42c820470bf710937627e)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
hw/xwayland/xwayland-input.c | 6 +++++-
|
||||
hw/xwayland/xwayland-input.h | 1 +
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
|
||||
index 766f11ff9..0d02b1b80 100644
|
||||
--- a/hw/xwayland/xwayland-input.c
|
||||
+++ b/hw/xwayland/xwayland-input.c
|
||||
@@ -1916,7 +1916,10 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
|
||||
release_touch(xwl_seat);
|
||||
}
|
||||
|
||||
- xwl_seat->xwl_screen->expecting_event--;
|
||||
+ if (xwl_seat->caps_initialized == FALSE) {
|
||||
+ xwl_seat->caps_initialized = TRUE;
|
||||
+ xwl_seat->xwl_screen->expecting_event--;
|
||||
+ }
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1967,6 +1970,7 @@ create_input_device(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version
|
||||
wl_registry_bind(xwl_screen->registry, id,
|
||||
&wl_seat_interface, min(version, seat_version));
|
||||
xwl_seat->id = id;
|
||||
+ xwl_seat->caps_initialized = FALSE;
|
||||
|
||||
xwl_cursor_init(&xwl_seat->cursor, xwl_seat->xwl_screen,
|
||||
xwl_seat_update_cursor);
|
||||
diff --git a/hw/xwayland/xwayland-input.h b/hw/xwayland/xwayland-input.h
|
||||
index 0a742f017..ef1198adf 100644
|
||||
--- a/hw/xwayland/xwayland-input.h
|
||||
+++ b/hw/xwayland/xwayland-input.h
|
||||
@@ -76,6 +76,7 @@ struct xwl_seat {
|
||||
struct xwl_window *tablet_focus_window;
|
||||
uint32_t id;
|
||||
uint32_t pointer_enter_serial;
|
||||
+ Bool caps_initialized;
|
||||
struct xorg_list link;
|
||||
CursorPtr x_cursor;
|
||||
OsTimerPtr x_cursor_timer;
|
||||
--
|
||||
2.54.0
|
||||
|
||||
50
0019-render-fix-multiple-mem-leaks-on-err-paths.patch
Normal file
50
0019-render-fix-multiple-mem-leaks-on-err-paths.patch
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
From b7ba6b5c61e9ee799881db8d5901311bc1a69013 Mon Sep 17 00:00:00 2001
|
||||
From: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
|
||||
Date: Thu, 5 Feb 2026 16:07:43 +0300
|
||||
Subject: [PATCH xserver 19/31] render: fix multiple mem leaks on err paths
|
||||
|
||||
Free nested allocations when initialization fails.
|
||||
Several code paths returned early on error without releasing
|
||||
memory owned by embedded structures, leading to leaks.
|
||||
|
||||
Found by Linux Verification Center (linuxtesting.org) with SVACE.
|
||||
|
||||
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
|
||||
(cherry picked from commit 809402414e4b84ad5c084221c7b4da9bd2c5d55d)
|
||||
|
||||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||||
---
|
||||
render/picture.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/render/picture.c b/render/picture.c
|
||||
index 6cc3e7e4c..b2ceed55e 100644
|
||||
--- a/render/picture.c
|
||||
+++ b/render/picture.c
|
||||
@@ -913,6 +913,7 @@ CreateLinearGradientPicture(Picture pid, xPointFixed * p1, xPointFixed * p2,
|
||||
|
||||
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
|
||||
if (*error) {
|
||||
+ free(pPicture->pSourcePict);
|
||||
free(pPicture);
|
||||
return 0;
|
||||
}
|
||||
@@ -958,6 +959,7 @@ CreateRadialGradientPicture(Picture pid, xPointFixed * inner,
|
||||
|
||||
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
|
||||
if (*error) {
|
||||
+ free(pPicture->pSourcePict);
|
||||
free(pPicture);
|
||||
return 0;
|
||||
}
|
||||
@@ -996,6 +998,7 @@ CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle,
|
||||
|
||||
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
|
||||
if (*error) {
|
||||
+ free(pPicture->pSourcePict);
|
||||
free(pPicture);
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.54.0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue