Commit Graph

20775 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult c3f042de23 Xi: allow hooks to silently ignore SelectEvents request
When looking up the window to select on and security hook returns
BadAccess, the request is just silently ignored, instead of rejected.

This way, security hook can prevent untrusted clients to listen on
arbitrary windows, without the client even noticing. The client won't
get this BadAccess error, but instead thinking everything's fine,
just not getting the actual events.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 349d13961d include: list.h: add duplicate checking add/append functions
Simplify cases where callers need to check whether an entry already is
in a list before adding / appending.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 536c3c7765 include: list.h: add xorg_list_present()
This function walks through the list and checks whether an entry is already
present. This check sometimes is neccessary, since trying to add an entry
twice has catastrophic consequences: iteration will become endless loop.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 9461072ab4 include: list.h: allow zero-initialization of struct xorg_list
Up until now, xorg_list's always need to be explicitly initialized by
calling xorg_list_init(), otherwise next access attempt will segfault.
This is adding extra complexity and risk of subtle bugs.

Adding some extra NULL check are trivial and their cost is so tiny
that it's even hard to practically measure.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 74766ee6bd include: list.h: document things that must not be done
Add some warnings that list entries must not be added twice.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult fc428a78a2 include: list.h: fix inline docs for xorg_list_append()
The docs stated it's prepending, while it's actually appending.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 473b8a0e38 dix: helper for checking whether window ID belongs to a root window
This helper checks whether a given XID belongs to some screen's
root window. It does so by looking up the window and comparing that
with the window's screen's root window pointer. The resource lookup
is intentionally being on behalf of the serverClient, so the fired
XACE hook doesn't treat it as an actual client's request.

It's explicitly designed for being used by callback handlers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 950cfb2bdc dix: helper for retrieving client owning a XID
Add a little helper that's looking up the ClientPtr to the client
of the owner of given XID. The lookup is solely done on the ID space,
the actual resource doesn't even need to exist.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 16215b98d2 dix: add selection filtering hooks
Add hooks for filtering and fully rewrite rewrite selection requests
and events (what existing XACE hooks cannot do), e.g. for supporting
separate selection name spaces.

The hook can change individual fields in the parameter struct, so
operation continues with these changed values (eg. replace the original
selection name atom by a different one). It's also possible to stop
operations completely (with given result code) - in that case the
hook needs to take care of the remaining work to do (eg. sending events)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult e6467895f9 dix: add dixAllocServerXID()
Adding a separate function for allocating server-client's XIDs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 4919a089df dix: refine docs on DeliverDeviceEvents()
Adding a bit more explaination on how events are passed upwards.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 8d89be2964 dix: hook for intercepting window property calls
This hook allows extensions to intercept client requests for changing
window attributes. It can either change the parameters or skip the
entire call (eg. handle all itself) so just the hook provided result
code is returned to the client.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 43dd9e5f43 dix: clean up MakeWindowOptional() calls and add alloc fault checks
a) no need to checking for win->optional == NULL before calling
   MakeWindowOptional(), because it checks itself
   (except some cases where it's presence has it's own semantics,
   or prevent unnecessary allocations)
b) lots of call sites didn't check for allocation failure.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 8966b04224 dix: unexport MakeWindowOptional()
Really internal, should not be used by drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult c092df17a8 dix: registry: add LookupDixAccessName()
Helper for converting Xace access masks to human-readable text.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult c4632a40dc dix: add callback for post root window init
Allow extensions to catch in right after a screen's root window has
been finally initialized

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 7b801906c5 mi: mark miWindowExposures() and miExpandDirectColors() exported
These are used by the in-tree libwfb.so module. As long as this an shared
object, instead of being directly linked into the executable, these symbols
need to be in the executable's symbol table. Nevertheless, they're not making
them part of the public SDK/module ABI, unless there's a really hard reason.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 2ce40f23b8 meson_options: disable Xwayland by default
Xwayland is a separate project/team and has it's own releases, so it's better
trying to to intefer with them and disable it by default.

It still can be easily enabled via meson arguments, and it's still enabled
in the CI. Let distros and operators decide on their own whether they want it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 41c039948f randr: re-export RRTransformSetFilter() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult ec7a89a92c randr: re-export RRClientKnowsRates() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 15bb2bbb37 randr: re-export RRProviderSetCapabilities() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult da3791e9ce randr: re-export RRProviderCreate() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 90c1f3b2a8 randr: re-export RRCrtcDetachScanoutPixmap() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 5f91adf017 randr: re-export RRCrtcGetTransform() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 49c6431695 xfree86: add per major-version driver/module subdirectories
Modules are now placed into a sub-directory by major Xserver release,
so we have less hassle with trying to load drivers w/ incompatible ABI.

The legacy directories are still searched (after the versioned ones)
for backwards compat with badly maintained proprietary drivers (Nvidia).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult a58dba71bd Revert "(!1991) xfree86: xf86Option: unexport xf86MarkOptionUsedByName()"
Reverting commit 63c8a689c3 on request by Nvidia
(proprietary driver)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 2ec00762f4 randr: re-export RRCrtcGetScanoutSize() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 1a534e204b randr: re-export RROutputSetNonDesktop() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 9696a151dd randr: re-export some resource type fields for NVidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs those fields for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult f25bf57cc2 xfree86: compat: re-export MarkClientException() for horryibly maintained Nvidia
NVidia yet again doing crazy shit in their proprietary drivers:

This is an DIX-*internal* function for triggering client teardown when
connection broke or somehow lack of resources to accept new connections.
Video drivers have no business with that whatsoever - having them messing
with client client connections is just insane.

But still trying to be kind with Nvidia victims, thus adding a little wrapper
function under the old name. It spills out a log warning calling users to file
bug reports their driver vendor.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 0b9a2fc6b0 dix: rename MarkClientException() to dixMarkClientException()
DIX functions should have proper naming.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 6a3b60cfe7 xfree86: increase ABI versions
Since *a lot* has changed since last Xserver release, need to increase
the ABI version.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 1c0d2410ea dix: fix guards in dix/window_priv.h
Renaming the guard define to _XSERVER_DIX_WINDOW_PRIV_H

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 2075d875ed README.md: add upgrade notice
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult c8a776f662 xfree86: compat: re-add xf86Msg() for badly maintained drivers.
NVidia yet again lagging behind a year with trivial cleanups,
even though they're informed about this function being deprecated
and dropped.

It spills out a log warning calling users to file bug reports their
driver vendor.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult d674029f1f Revert "(!1987) glamor: unexport GLAMOR_CREATE_PIXMAP_* defines"
This reverts commit 85267d38ac.

These are needed by the RDP module (www.xrdp.org).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 3d21a15f54 xfree86: fix possible buffer overflow in xf86PrintBanner()
There's chance of buffer overflow happending due lack of zero-termination
of printed string. Making sure the buffer is always propertly terminated.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1821

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 329b7c8631 xfree86: xf86Priv.h: unexport xf86HasTTYs()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 806748ddd4 xfree86: xf86Priv.h: unexport xf86CallDriverProbe()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 86b05c5fae xfree86: xf86Priv.h: unexport xf86LoadModules()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 2af74d6985 xfree86: xf86Priv.h: unexport xf86CloseLog()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult bb89c30942 xfree86: xf86Priv.h: unexport xf86LogInit()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 7b4f951670 xfree86: xf86Priv.h: unexport xf86PMConfirmEventToOs field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 5112ab6537 xfree86: xf86Priv.h: unexport xf86PMGetEventFromOs field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult b4daa83ef2 xfree86: xf86Priv.h: unexport xf86HandlePMEvents()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 9f87f854ea xfree86: xf86Priv.h: unexport xf86Wakeup()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:47 +02:00
Enrico Weigelt, metux IT consult 8ec5445ff0 xfree86: xf86Priv.h: unexport DoShowOptions()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:47 +02:00
Enrico Weigelt, metux IT consult 77ec0be813 xfree86: xf86Priv.h: unexport DoConfigure()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:47 +02:00
Enrico Weigelt, metux IT consult 2890d16aab xfree86: xf86Priv.h: unexport xf86PathIsSafe()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:47 +02:00
Enrico Weigelt, metux IT consult 2172796323 xfree86: xf86Priv.h: unexport xf86RemoveDevFromEntity()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:47 +02:00