Commit graph

19624 commits

Author SHA1 Message Date
Alan Coopersmith
87e53afd9c Xext/shm: avoid null dereference in ShmInitScreenPriv()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../Xext/shm.c:213:23: acquire_memory: this call could return NULL
xwayland-24.1.6/redhat-linux-build/../Xext/shm.c:214:9: danger: ‘screen_priv’ could be NULL: unchecked value from [(19)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/18)
#  212|       if (!screen_priv) {
#  213|           screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
#  214|->         screen_priv->CloseScreen = pScreen->CloseScreen;
#  215|           dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
#  216|           pScreen->CloseScreen = ShmCloseScreen;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-07 23:23:05 +00:00
Alan Coopersmith
d9389873d6 Strip trailing whitespace from source files
Performed with: `git ls-files | xargs perl -i -p -e 's{[ \t]+$}{}'`

`git diff -w` & `git diff -b` show no diffs from this change

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2074>
2025-10-05 11:56:48 -07:00
Alan Coopersmith
5210495f7d xfree86: Fix -Wdiscarded-qualifiers warnings in SPARC Sbus probe code
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>
2025-10-03 10:55:17 -07:00
Alan Coopersmith
a8f8ec7e7d meson: fix build if shmfence is enabled but dri3 & xwayland are not
glamor_sync.c calls miSyncShmScreenInit if HAVE_XSHMFENCE is defined,
but it was only being built if either dri3 or xwayland were enabled.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>
2025-10-03 10:55:17 -07:00
Alan Coopersmith
c62cd2feaa xfree86: add missing headers to build sun_init.c on Solaris/SPARC
Fixes: 0f715b4ca ("xfree86: os-support: move hidden Solaris-specific symbols out of public header")
Fixes: e2fa0d2ae ("fix including <sys/mman.h>")

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>
2025-10-03 10:55:17 -07:00
Alan Coopersmith
908f0a488d xfree86: fix meson build on 64-bit Solaris/SPARC systems
For cpu_family(), meson returns "sparc" for 32-bit sparc,
and "sparc64" for 64-bit sparc, regardless of the OS in use.

For cpu(), meson returns values like "sun4v" on Solaris/SPARC,
and doesn't promise stability of the values, or portability across
OS'es, unlike cpu_family().

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2070>
2025-10-03 10:55:17 -07:00
Alan Coopersmith
3ec5f6bcc3 os: Use EVP APIs when building with OpenSSL 3
Avoids deprecation warnings for old SHA1 APIs in OpenSSL 3.0 and later

Closes: #1845
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2066>
2025-09-29 17:35:28 +00:00
Alan Coopersmith
7013984b5f test: add unit tests for x_sha1_* functions in os/xsha1.c
Simple confirmation of known values, not exhaustive testing.

Tested with SHA-1 implementations from:
 - libcrypto (OpenSSL 3)
 - libgcrypt
 - libnettle
 - Solaris libmd

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2066>
2025-09-29 17:35:28 +00:00
Alan Coopersmith
23c103d41f panoramix: avoid null dereference in PanoramiXConsolidate()
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2065>
2025-09-20 16:45:59 -07:00
Alan Coopersmith
537b56ccca panoramix: avoid null dereference in PanoramiXMaybeAddDepth()
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2065>
2025-09-20 16:35:46 -07:00
Mikhail Dmitrichenko
dd5c2595a4 dix: avoid null ptr deref at doListFontsWithInfo
In the doListFontsWithInfo function in dixfonts.c, when a font alias is
encountered (err == FontNameAlias), the code saves the current state
and allocates memory for c->savedName.

If the malloc(namelen + 1) call fails, c->savedName remains NULL,
but c->haveSaved is still set to TRUE. Later, when a font is
successfully resolved (err == Successful), the code uses c->savedName
without checking if it is NULL, so there is potential null ptr
dereference. XNFalloc will check result of malloc and stop
program execution if allocation was failed.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1842
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2062>
2025-09-20 22:05:27 +00:00
Mikhail Dmitrichenko
8d25a89143 os: avoid potential out-of-bounds access at logVHdrMessageVerb
The LogVHdrMessageVerb function may access an array out of bounds in a
specific edge case. Specifically, the line:

newline = (buf[len - 1] == '\n');

can result in accessing buf[-1] if len == 0, which is undefined behavior.

Commit adds check to avoid access out of bounds at pointed line.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1841
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2061>
2025-09-20 21:59:34 +00:00
Mikhail Dmitrichenko
b096785df4 xwayland: Fix search of duplicate lease names
Commit d36f66f15d ("Check for duplicate output names") would walk the
list of existing outputs and leases to check that no other existing
output has the same name.

The change however, inadvertently reused the regular screen outputs when
searching the leased names.

Fix this by using the lease name, not the regular output names that we
already checked just above.

Found by SAST tool Svace.

Fixes: d36f66f15d - xwayland: Check for duplicate output names
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1843
Reviewed-by Olivier Fourdan <ofourdan@redhat.com>

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2063>
2025-09-18 09:55:47 +00:00
Nicolas Guichard
bcc0587ab9 xwayland: Fix minimum wl_compositor protocol version
Commit 54f8fc4090 introduced the use of
wl_surface::set_buffer_scale, which is only available starting with
version 3 of the wl_compositor protocol. Because we already prefer
version 4 when available, this went unnoticed but broke versions 1, 2
and 3 when reaching the wl_surface::set_buffer_scale call.

This restores functionality for version 3 and properly document that
versions 1 and 2 are not supported anymore.

Signed-off-by: Nicolas Guichard <nicolas.guichard@kdab.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1862>
2025-09-18 11:40:44 +02:00
Ian Forbes
afc8b781d8 xwayland: Try harder to find a top-level for root grabs
The commit referenced below partially resolved an issue with grabs being made
on the root window. Unfortunately it assumes that the application uses
the same client for all windows. VMware Workstation uses nested windows
for each VM, each of which runs its own process with this own client.
Theses windows are managed by the GUI which is the top level for the
application and maps the windows based on which tab is selected.

Because the VM windows issue a grab on the root window and don't share
the same client as the GUI, grabs don't work properly with global shortcut
inhibition being completely broken.

Getting the parent top-level of the nested windows fixes this issue.

Fixes: c7730cfe55 ("xwayland: Translate keyboard grabs on the root window")
Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2016>
2025-09-12 07:47:39 +00:00
Alan Coopersmith
b644922366 Revert "dix: unexport rootCursor"
This reverts commit a2f72755a9.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:39 +00:00
Alan Coopersmith
b858cb5ccd Revert "dix: unexport cursor refcounting functions"
This reverts commit 4aadbeb8aa.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:39 +00:00
Alan Coopersmith
1d2a590cfb Revert "dix: unexport cursor allocation functions"
This reverts commit 24f3c4a508.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:39 +00:00
Alan Coopersmith
cfdcd22199 Revert "dix: unexport ServerBitsFromGlyph()"
This reverts commit 974cd2b5f2.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:38 +00:00
Alan Coopersmith
e85fe61714 Revert "dix: unexport CursorMetricsFromGlyph()"
This reverts commit 0c354e9166.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:38 +00:00
Alan Coopersmith
7b87dff067 Revert "dix: unexport CheckCursorConfinement()"
This reverts commit 24d1c08441.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:38 +00:00
Alan Coopersmith
774da7dfc0 Revert "dix: unexport NewCurrentScreen()"
This reverts commit bd3c252710.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:37 +00:00
Alan Coopersmith
b75173a283 Revert "dix: unexport PointerConfinedToScreen()"
This reverts commit 9673886fac.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:37 +00:00
Alan Coopersmith
066b377fc9 Revert "dix: unexport GetSpritePosition()"
This reverts commit eb81769b58.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:37 +00:00
Alan Coopersmith
372ca9114c Revert "dix: drop superfluous XineramaGetCursorScreen()"
This reverts commit 6c7c4fdc7e.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2058>
2025-09-06 17:01:36 +00:00
Alan Coopersmith
777de747b9 meson.build: include Xephyr in output of which ddx we're building
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2059>
2025-08-31 12:43:56 -07:00
Alan Coopersmith
cc7b0b7681 modesetting: fix modesetting symbol test when glx is disabled
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
48acd1ae78 xwayland: fix builds with xace disabled
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
ec14ecf751 modesetting: Fix builds with pciaccess or udev_kms disabled
CI meson-disable-options builds were failing with:
../hw/xfree86/drivers/modesetting/driver.c:127:5: error: ‘ms_device_match’
 undeclared here (not in a function)
  127 |     ms_device_match,
      |     ^~~~~~~~~~~~~~~
../hw/xfree86/drivers/modesetting/driver.c: In function ‘ms_get_drm_master_fd’:
../hw/xfree86/drivers/modesetting/driver.c:1179:19: error: variable ‘pEnt’
 set but not used [-Werror=unused-but-set-variable]
 1179 |     EntityInfoPtr pEnt;
      |                   ^~~~
../hw/xfree86/drivers/modesetting/driver.c: At top level:
../hw/xfree86/drivers/modesetting/driver.c:84:13: error: ‘ms_pci_probe’
 used but never defined [-Werror]
   84 | static Bool ms_pci_probe(DriverPtr driver,
      |             ^~~~~~~~~~~~
../hw/xfree86/drivers/modesetting/driver.c:313:1: error: ‘probe_hw_pci’
 defined but not used [-Werror=unused-function]
  313 | probe_hw_pci(const char *dev, struct pci_device *pdev)
      | ^~~~~~~~~~~~

Fixes: a72bdf170 ("modesetting: rewrite probing based on fbdev.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
7b15321b3b meson: don't build xselinux if xace is disabled
xselinux requires xace to build

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
6611caf828 dix: Fix builds with meson -Dxace=false -Dwerror=true
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
8bbf497e22 Xace: provide definitions of new hook functions when xace is disabled
Building with -Dxace=false was generating many failures of the form:

../dix/cursor.c: In function ‘AllocARGBCursor’:
../dix/cursor.c:281:10: error: implicit declaration of function
 ‘XaceHookResourceAccess’; did you mean ‘XaceHookPropertyAccess’?
 [-Werror=implicit-function-declaration]
  281 |     rc = XaceHookResourceAccess(client, cid, X11_RESTYPE_CURSOR,
      |          ^~~~~~~~~~~~~~~~~~~~~~
      |          XaceHookPropertyAccess

Fixes: ae3c57333 ("xace: typesafe hook function for XACE_RESOURCE_ACCESS")
Fixes: 9524ffee8 ("xace: typesafe hook function for XACE_DEVICE_ACCESS")
Fixes: 67e468c8b ("xace: typesafe hook function for XACE_SEND_ACCESS")
Fixes: 3dfe00d5e ("xace: typesafe hook function for XACE_RECEIVE_ACCESS")
Fixes: 922b7685d ("xace: typesafe hook function for XACE_CLIENT_ACCESS")
Fixes: 0f6bb23bc ("xace: typesafe hook function for XACE_EXT_ACCESS")
Fixes: 47d6c3ad7 ("xace: typesafe hook function for XACE_SERVER_ACCESS")
Fixes: 51d8bcfc0 ("xace: typesafe hook function for XACE_SCREEN_ACCESS")
Fixes: 305f2d59d ("xace: typesafe hook function for XACE_SCREENSAVER_ACCESS")
Fixes: 591d95c79 ("xace: typesafe hook function for XACE_AUTH_AVAIL")
Fixes: facdaae4e ("xace: typesafe hook function for XACE_KEY_AVAIL")

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
6f6a635363 ci: run builds with most options enabled and most options disabled
We have too many options to run an exhaustive matrix of the combinations,
but this should at least help us catch code that won't compile in many
of the ifdef paths we don't go down in the default configs.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2056>
2025-08-30 10:01:32 -07:00
Alan Coopersmith
d03c84b57f xfree86: Fix builds with gcc -Wpedantic
../hw/xfree86/loader/loadmod.c:85:33: warning: ISO C forbids empty
 initializer braces before C23 [-Wpedantic]
   85 | static int ModuleDuplicated[] = { };
      |                                 ^
../hw/xfree86/loader/loadmod.c:85:12: error: zero or negative size array
 ‘ModuleDuplicated’
   85 | static int ModuleDuplicated[] = { };
      |            ^~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2054>
2025-08-23 15:38:40 +00:00
Alan Coopersmith
dcd1ffa0c2 Revert "Xext: shape: clean up Xinerama dispatch"
This reverts commit a57db845bb.

It breaks when building with -Dxinerama=false:

../Xext/shape.c: In function ‘ProcShapeRectangles’:
../Xext/shape.c:318:12: error: too few arguments to function
 ‘ShapeRectangles’; expected 2, have 1
  318 |     return ShapeRectangles(client);
      |            ^~~~~~~~~~~~~~~

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2055>
2025-08-19 23:56:27 +00:00
Alan Coopersmith
e6ec0bfde8 xf86bigfont: fix -Werror=unused-variable build failure
../Xext/xf86bigfont.c: In function ‘SProcXF86BigfontQueryVersion’:
../include/dix.h:65:12: error: unused variable ‘stuff’
 [-Werror=unused-variable]
   65 |     type * stuff = (type *)client->requestBuffer;
      |            ^~~~~
../Xext/xf86bigfont.c:654:5: note: in expansion of macro ‘REQUEST’
  654 |     REQUEST(xXF86BigfontQueryVersionReq);
      |     ^~~~~~~

Fixes: 776efd3cf ("Xext: xf86bigfont: drop swapping request length fields")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 10:09:14 -07:00
Alan Coopersmith
d56c848523 xf86bigfont: Fix -Werror=missing-prototypes build failure
../Xext/xf86bigfont.c: At top level:
../Xext/xf86bigfont.c:683:1: error: no previous prototype for
 ‘XFree86BigfontExtensionInit’ [-Werror=missing-prototypes]
  683 | XFree86BigfontExtensionInit(void)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 33350ef8f ("include: move private definitions out of extinit.h")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 10:01:54 -07:00
Alan Coopersmith
4ca8b9a474 ci: enable xf86bigfont in one set of builds
Hopefully this will avoid us accepting more changesets that break it

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 09:54:08 -07:00
Alan Coopersmith
0617f6075b xf86bigfont: fix -Wimplicit-function-declaration error
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 09:48:49 -07:00
Alan Coopersmith
faa511117d Revert "os: move AbortServer() to os/utils.c"
This reverts commit 8e8bf63908.

It failed to build if xf86bigfont was enabled:
../os/utils.c: In function ‘AbortServer’:
../os/utils.c:1555:5: error: implicit declaration of function
 ‘XF86BigfontCleanup’ [-Wimplicit-function-declaration]
 1555 |     XF86BigfontCleanup();
      |     ^~~~~~~~~~~~~~~~~~

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 09:38:57 -07:00
Alan Coopersmith
cbe118373d Revert "Xext: xf86bigfont: split reply header and payload"
This commit doesn't compile, but wasn't noticed since xf86bigfont
isn't enabled by default, so wasn't being built in our CI builds.
(The ".type = X_Reply;" line needs to end with a , not a ;)

This reverts commit b5a3ac9527.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
2025-08-10 09:08:03 -07:00
Alan Coopersmith
061690c2e6 Re-export Ones()
It's used by the nvidia driver

Fixes: 1642adec3 ("dix: unexport Ones()")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2051>
2025-08-02 17:21:00 -07:00
Alan Coopersmith
bf867b4658 Revert "os: unexport Os*() functions"
OsBlockSignals & OsReleaseSignals are required by libint10.so

This reverts commit be4c8444eb.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2049>
2025-07-20 12:41:06 -07:00
Twaik Yont
5568b0f83f 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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1906>
2025-07-19 21:42:37 +00:00
liuheng
9b6f72395a config: Preserve section data when parsing duplicate files
Previously, when parsing multiple configuration files containing the same
section names, only the last occurrence of each section would be retained.
Earlier definitions were silently discarded due to unconditional memory
allocation and overwriting of pointers during parsing.

This resulted in incomplete or incorrect configuration state when users
intended to merge or extend configuration through multiple files.

The section parsing functions in Files.c, Flags.c, and Module.c now
accept existing section pointers. These functions allocate new memory only
if the input pointer is NULL, preserving earlier data when re-parsing.

read.c has been updated to detect and pass existing section pointers when
encountering duplicate sections across files, preventing loss of prior content.

With these changes, the parser properly accumulates and merges configuration
data across multiple files, ensuring that all relevant settings are preserved.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/467
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2045>
2025-07-19 20:58:11 +00:00
Martin von Gagern
0d39d7a8f3 modesetting: Check for NULL mode_output before printing warning message
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1816
Signed-off-by: Martin von Gagern <gagern@google.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1938>
2025-07-19 20:52:27 +00:00
Michel Dänzer
010c00828a xwayland/present: Only flip if the window pixmap dimensions match
If they don't, attaching the new buffer changes the dimensions of the
wl_surface representing the window, which can break stuff as described
in https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2044 .

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2047>
2025-07-18 14:33:08 +00:00
Alan Coopersmith
94e01f7d5c Revert "dix: generate MakePredeclaredAtoms() from BuiltInAtoms file"
This reverts commit 44e6558934.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2048>
2025-07-16 17:14:51 -07:00
Alan Coopersmith
e923310d2f Revert "dix: unexport MakePredeclaredAtoms()"
This reverts commit b3ec0bf58a.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2048>
2025-07-16 17:14:21 -07:00
Alan Coopersmith
122345d484 Revert "xkb: move XkbConvertGetByNameComponents and make it static"
This reverts commit 114c1c84b1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
2025-07-12 11:47:06 -07:00