Commit Graph

19486 Commits

Author SHA1 Message Date
Alan Coopersmith 51cfefd59f Revert "kdrive: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 4378656cbb.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith 1b6b2bcee1 Revert "vfb: use dixDestroyPixmap() instead of direct driver call"
This reverts commit c117925ace.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith ab5e559771 Revert "xfree86: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 4d1953728e.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith 21de52dfbe Revert "xwayland: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 0132baa422.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith 23dcedf8ba Revert "glx: use dixDestroyPixmap() instead of direct driver call"
This reverts commit 69837185c0.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith 8b47b53226 Revert "exa: simplify CreatePixmap()/DestroyPixmap() handlers error pathes"
This reverts commit ee798cf212.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Alan Coopersmith e48b1aaa97 Revert "dix: add in-code docs for dixDestroyPixmap()"
This reverts commit b61647f3a1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
2025-06-17 20:02:16 +00:00
Olivier Fourdan 0235121c6a xfree86: Check for RandR provider functions
Changing XRandR provider properties if the driver has set no provider
function such as the modesetting driver will cause a NULL pointer
dereference and a crash of the Xorg server.

Related to CVE-2025-49180

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan 3c3a4b767b randr: Check for overflow in RRChangeProviderProperty()
A client might send a request causing an integer overflow when computing
the total size to allocate in RRChangeProviderProperty().

To avoid the issue, check that total length in bytes won't exceed the
maximum integer value.

CVE-2025-49180

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan 2bde9ca49a record: Check for overflow in RecordSanityCheckRegisterClients()
The RecordSanityCheckRegisterClients() checks for the request length,
but does not check for integer overflow.

A client might send a very large value for either the number of clients
or the number of protocol ranges that will cause an integer overflow in
the request length computation, defeating the check for request length.

To avoid the issue, explicitly check the number of clients against the
limit of clients (which is much lower than an maximum integer value) and
the number of protocol ranges (multiplied by the record length) do not
exceed the maximum integer value.

This way, we ensure that the final computation for the request length
will not overflow the maximum integer limit.

CVE-2025-49179

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan d55c54cecb os: Account for bytes to ignore when sharing input buffer
When reading requests from the clients, the input buffer might be shared
and used between different clients.

If a given client sends a full request with non-zero bytes to ignore,
the bytes to ignore may still be non-zero even though the request is
full, in which case the buffer could be shared with another client who's
request will not be processed because of those bytes to ignore, leading
to a possible hang of the other client request.

To avoid the issue, make sure we have zero bytes to ignore left in the
input request when sharing the input buffer with another client.

CVE-2025-49178

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan ab02fb96b1 xfixes: Check request length for SetClientDisconnectMode
The handler of XFixesSetClientDisconnectMode does not check the client
request length.

A client could send a shorter request and read data from a former
request.

Fix the issue by checking the request size matches.

CVE-2025-49177

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Fixes: e167299f6 - xfixes: Add ClientDisconnectMode
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:24 +02:00
Olivier Fourdan 03731b326a os: Do not overflow the integer size with BigRequest
The BigRequest extension allows requests larger than the 16-bit length
limit.

It uses integers for the request length and checks for the size not to
exceed the maxBigRequestSize limit, but does so after translating the
length to integer by multiplying the given size in bytes by 4.

In doing so, it might overflow the integer size limit before actually
checking for the overflow, defeating the purpose of the test.

To avoid the issue, make sure to check that the request size does not
overflow the maxBigRequestSize limit prior to any conversion.

The caller Dispatch() function however expects the return value to be in
bytes, so we cannot just return the converted value in case of error, as
that would also overflow the integer size.

To preserve the existing API, we use a negative value for the X11 error
code BadLength as the function only return positive values, 0 or -1 and
update the caller Dispatch() function to take that case into account to
return the error code to the offending client.

CVE-2025-49176

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:21:10 +02:00
Olivier Fourdan 0885e0b262 render: Avoid 0 or less animated cursors
Animated cursors use a series of cursors that the client can set.

By default, the Xserver assumes at least one cursor is specified
while a client may actually pass no cursor at all.

That causes an out-of-bound read creating the animated cursor and a
crash of the Xserver:

 | Invalid read of size 8
 |    at 0x5323F4: AnimCursorCreate (animcur.c:325)
 |    by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
 |    by 0x52DC80: ProcRenderDispatch (render.c:1999)
 |    by 0x4A1E9D: Dispatch (dispatch.c:560)
 |    by 0x4B0169: dix_main (main.c:284)
 |    by 0x4287F5: main (stubmain.c:34)
 |  Address 0x59aa010 is 0 bytes after a block of size 0 alloc'd
 |    at 0x48468D3: reallocarray (vg_replace_malloc.c:1803)
 |    by 0x52D3DA: ProcRenderCreateAnimCursor (render.c:1802)
 |    by 0x52DC80: ProcRenderDispatch (render.c:1999)
 |    by 0x4A1E9D: Dispatch (dispatch.c:560)
 |    by 0x4B0169: dix_main (main.c:284)
 |    by 0x4287F5: main (stubmain.c:34)
 |
 | Invalid read of size 2
 |    at 0x5323F7: AnimCursorCreate (animcur.c:325)
 |    by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
 |    by 0x52DC80: ProcRenderDispatch (render.c:1999)
 |    by 0x4A1E9D: Dispatch (dispatch.c:560)
 |    by 0x4B0169: dix_main (main.c:284)
 |    by 0x4287F5: main (stubmain.c:34)
 |  Address 0x8 is not stack'd, malloc'd or (recently) free'd

To avoid the issue, check the number of cursors specified and return a
BadValue error in both the proc handler (early) and the animated cursor
creation (as this is a public function) if there is 0 or less cursor.

CVE-2025-49175

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
2025-06-17 14:18:58 +02:00
Alan Coopersmith 3bdb541e04 Revert "os: move BUG_*() macros to own private header"
This reverts commit 346d5f5c35.
That commit did not handle copyright/license notices correctly.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2019>
2025-06-13 17:13:54 -07:00
Alan Coopersmith 538a6dd76f Revert "xfree86: mark LoaderShouldIgnoreABI() and LoaderGetABIVersion() deprecated"
This reverts commit 4f2c6c98b7.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2017>
2025-06-13 22:48:22 +00:00
Alan Coopersmith c7b69f1acb Revert "misc.h: drop LengthRestB() macro"
This reverts commit a6b2eb3780

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2015>
2025-06-13 22:30:27 +00:00
Alan Coopersmith cd583932a1 Revert "misc.h: move out checked_int64_(add|subtract)"
This reverts commit de0aed0543

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2014>
2025-06-13 22:13:22 +00:00
Alan Coopersmith 55ad737a9f Revert "misc.h: move out MAXEXTENSIONS to geext.c"
This reverts commit 80593ab279.

This is a fundamental property of the X11 core protocol,
there is no benefit to hiding it, it can't change.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2013>
2025-06-13 22:03:45 +00:00
Marge Bot ff8d250589 Merge branch 'xrandr-reverts' into 'master'
Revert "randr cleanups"

See merge request xorg/xserver!2012
2025-06-13 21:58:15 +00:00
Alan Coopersmith e3d0666386 Revert "randr: let SProc*'s call their Proc*'s directly"
This reverts commit ed17224403.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:44:43 -07:00
Alan Coopersmith c35a285398 Revert "randr: use explicit case statement instead of ProcRandrVector table"
This reverts commit 42677ae1e3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:44:30 -07:00
Alan Coopersmith bc76e25994 Revert "randr: use explicit case statement instead of SProcRandrVector table"
This reverts commit 058815bed1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:44:17 -07:00
Alan Coopersmith 9f72353a51 Revert "randr: RRCrtcCreate(): drop unnecessary zero assigments"
This reverts commit 6d2c42d0c8.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:44:02 -07:00
Alan Coopersmith 160abf285c Revert "randr: use struct initializer for reply structs"
This reverts commit 7eff742ef2.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:43:47 -07:00
Alan Coopersmith 9c53c6cf76 Revert "randr: ProcRRGetCrtcInfo(): use locally scoped variables"
This reverts commit 90abc95c85.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:43:36 -07:00
Alan Coopersmith c371d11af0 Revert "randr: ProcRRGetCrtcTransform(): split reply header and payload"
This reverts commit c6f1b8a735.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:43:23 -07:00
Alan Coopersmith 9b753c3970 Revert "randr: ProcRRGetMonitors() use SwapLongs instead of callbacks"
This reverts commit 203f59c6d3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:43:00 -07:00
Alan Coopersmith a205917752 Revert "randr: ProcRRGetMonitors(): collect reply payload in temporary buffer"
This reverts commit 1bc6ca30a9.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:42:33 -07:00
Alan Coopersmith 896d9d3be8 Revert "randr: RROutputCreate(): use calloc()"
This reverts commit 3d3137513a.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:42:13 -07:00
Alan Coopersmith 9f2b9adbe3 Revert "randr: RRCreateProviderProperty(): use calloc()"
This reverts commit 05188ccec1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:41:53 -07:00
Alan Coopersmith e77b465eb6 Revert "randr: ProcRRGetOutputProperty(): rename reply struct to "rep""
This reverts commit 53d43bd8dc.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:41:29 -07:00
Alan Coopersmith 01914b1c53 Revert "randr: ProcRRGetOutputProperty(): use SwapShort()/SwapLong()"
This reverts commit 8789be52a4.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:41:13 -07:00
Alan Coopersmith 3a76d12ef0 Revert "randr: ProcRRGetProviderProperty(): use SwapShort()/SwapLong()"
This reverts commit 62b8497999.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:40:33 -07:00
Alan Coopersmith bddafe4001 Revert "randr: ProcRRGetCrtcGamma(): use SwapShort()/SwapLong()"
This reverts commit d9863f7cb0.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:38:23 -07:00
Alan Coopersmith 6a0c430b25 Revert "randr: ProcRRListOutputProperties(): use SwapShort()/SwapLong()"
This reverts commit e3001b71b3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:38:12 -07:00
Alan Coopersmith 8650028e59 Revert "randr: ProcRRQueryOutputProperty(): use SwapShort()/SwapLong()"
This reverts commit 73467faeb2.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:37:57 -07:00
Alan Coopersmith fc7858a458 Revert "randr: RRScreenInit(): drop unnecessary zero'ing"
This reverts commit 6fad884ce7.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:36:45 -07:00
Alan Coopersmith 36af7a5f9c Revert "randr: fix RRGetCrtcTransform reply length"
This reverts commit 0ca5aaba50.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:36:22 -07:00
Alan Coopersmith eca05b85f9 Revert "randr: fix RRGetCrtcTransform reply length, part 2"
This reverts commit 53876f1ef1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
2025-06-11 13:35:44 -07:00
Olivier Fourdan 8cb078f8b6 xwayland: Do not pretend leaving the X11 surface if buttons are down
Xwayland has its own XYToWindow() handler to account for the case when
the pointer leaves an X11 surface to enter another Wayland native
window.

When that occurs, Xwayland will treat it as if the pointer had entered
the root window so that the X11 clients receive an appropriate leave
event.

When the pointer leaves the X11 surface, Xwayland will call
CheckMotion() to update the sprite coordinates and possibly the cursor.

However, if we left the surface with a button down, it means the wayland
compositor has grabbed the pointer so we will not get button release
events from the compositor.

Once the button is released, Xwayland will get a pointer enter event from
the compositor, and Xwayland will clear up the buttons pressed.

But that might confuse Xwayland in thinking the pointer has crossed the
windows and leave the wrong cursor showing in the X11 surface.

To avoid the issue, if buttons are down, do not pretend the cursor has
left the X11 surface for the root window.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1811
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2008>
2025-06-05 07:29:03 +00:00
Olivier Fourdan 8a77ab083f Revert "xwayland: Update sprite prior to clearing the focus window"
This breaks regular toplevel enter/leave events when crossing to/from a
native Wayland window.

A better fix for the original issue follows.

This reverts commit b97b459c06.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2008>
2025-06-05 07:29:03 +00:00
Alan Coopersmith 0d2213ec44 Xephyr.man: Use \- to get ASCII hyphens instead of Unicode dashes
Used in command-line arguments and email addresses

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 15:15:13 -07:00
Alan Coopersmith ff4f2f718b man pages: don't use .BI macro with a single argument
Clears warnings from groff -rCHECKSTYLE=10:

an.tmac: Xephyr.man:53: style: .BI expects at least 2 arguments, got 1
an.tmac: Xephyr.man:55: style: .BI expects at least 2 arguments, got 1
an.tmac: Xwayland.man:151: style: .BI expects at least 2 arguments, got 1
an.tmac: Xwayland.man:166: style: .BI expects at least 2 arguments, got 1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 15:10:35 -07:00
Alan Coopersmith 286578e83e XWin.man: fix typos in font change escapes
Fixes warnings from `mandoc -T lint`:

mandoc: XWin.man:332:28: WARNING: invalid escape sequence: \fp
mandoc: XWin.man:397:1: WARNING: invalid escape sequence: \fX

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 15:06:23 -07:00
Alan Coopersmith bd08e04fcb man pages: remove extraneous PP macros
Clears warnings from `mandoc -T lint` of the forms:
mandoc: Xorg.man:26:2: WARNING: skipping paragraph macro: PP after SH
mandoc: Xorg.man:40:2: WARNING: skipping paragraph macro: PP empty

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 15:01:49 -07:00
Alan Coopersmith 6dfe3e7db6 man pages: strip trailing whitespace
Gets rid of many warnings from `mandoc -T lint` of the form:
mandoc: ./man/Xserver.man:621:7: STYLE: whitespace at end of input line

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2009>
2025-05-31 14:51:24 -07:00
Alan Coopersmith 7aa1f121e4 mi: use common implementation of bit counting function
Reduce a bit of unexplained magic, and use ISA extensions where available

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1984>
2025-05-20 00:34:23 +00:00
Enrico Weigelt, metux IT consult 73f3c47608 randr: fix unconditional byte-swap in ProcRRGetProviderInfo()
The list of the associated provider's capabilities was always swapped
unconditionally, while it should only be in case of client having
opposite endianess.

Fixes: 426bc0a28e
Reported-By: dasha_uwu
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1977>
2025-05-18 23:42:19 +00:00
Enrico Weigelt, metux IT consult f0fd9f8bf4 dix: fix warning on redefinition of typedefs
| ../dix/input_priv.h:56:29: warning: redefinition of typedef 'InputOption' is a C11 feature [-Wtypedef-redefinition]
|    56 | typedef struct _InputOption InputOption;
|       |                             ^
| ../include/input.h:255:29: note: previous definition is here
|   255 | typedef struct _InputOption InputOption;
|       |                             ^
| In file included from ../hw/xfree86/common/xf86Cursor.c:36:
| ../dix/input_priv.h:57:25: warning: redefinition of typedef 'XI2Mask' is a C11 feature [-Wtypedef-redefinition]
|    57 | typedef struct _XI2Mask XI2Mask;
|       |                         ^
| ../include/input.h:256:25: note: previous definition is here
|   256 | typedef struct _XI2Mask XI2Mask;
|       |                         ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1978>
2025-05-18 17:35:31 +00:00