Commit Graph

1220 Commits

Author SHA1 Message Date
notbabaisyou 8f50b8cc19 Xext: Fix typo in xace.h
`modsetting` -> `modesetting`

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-06-27 17:10:33 +02:00
Mike Gelfand b5d569a884 xext: add/fix include guards where missing/broken
Signed-off-by: Mike Gelfand <mikedld@mikedld.com>
2025-06-27 13:58:05 +02:00
dec05eba 4267785e6f xres: fix XResQueryClientIds always returning 0 clients
XaceHookClientAccess added in 098008879b
has incorrect condition in ConstructClientIds.

This fixes #182

Signed-off-by: dec05eba <dec05eba@protonmail.com>
2025-06-19 11:29:24 +02:00
dasha_uwu 8ebab6ca3e panoramix: export PanoramiXTranslateVisualID for nvidia
Signed-off-by: dasha_uwu <dasha@linuxping.win>
2025-06-16 10:32:48 +02:00
dasha_uwu a776156b54 treewide: preemptively revert !1714 where it affects ABI compatibility
this adds dummy pointers in place of removed fields in some structs, only for
SDK headers, to preserve ABI
some of these fix segfaults for nvidia driver, some are preemptive

Signed-off-by: dasha_uwu <dasha@linuxping.win>
2025-06-16 10:32:48 +02:00
dasha_uwu e73bb5d01b geext: export GERegisterExtension for nvidia
Signed-off-by: dasha_uwu <dasha@linuxping.win>
2025-06-16 10:32:48 +02:00
dec05eba f397039d65 xres/xkb/xvmc/modesetting: Fix incorrect pointer data size usage
* xled change tested with `xset led named "Scroll Lock"`
* modesetting change tested with `xrandr --output DP-1 --gamma 0.5:0.5:0.5`.
  Without this fix that command does nothing
* xvmc change tested with `mpv --vo=xv video.mp4`

Of the currently reported issues this fixes #104

Signed-off-by: dec05eba <dec05eba@protonmail.com>
2025-06-13 13:01:24 +02:00
Enrico Weigelt, metux IT consult 5fbb2ae1df Xext: xf86bigfont: fix FTBS on wrong packet length variable.
The `buflength` variable doesn't exist anymore, it's `rlength`.
And even if the reply struct might have the same size as XGenericReply,
it's cleaner to let the compiler compute it explicitly, just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult c76f0d1d96 Xext: xf86bigfont: fix typo in ProcXF86BigfontQueryFont()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 9d7b9691b0 Xext: xf86bigfont: fix missing includes
It seems xf86bigfont hasn't been compile-tested for long time,
some includes were missing.

Note that fontstruct.h needs to come before libxfont2.h, because X11
headers tend to be not self-consistent :(

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 7f49d4644f panoramix: export XRC_DRAWABLE for Nvidia legacy
Yet another temporary re-export for Nvidia's proprietary driver.
This symbol really shouldn't be used at all 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 a353ffddd0 Xnamespace: add support for multiple auth tokens per namespace
Support having more than one auth token per namespace, so separate tokens
can be handed out to clients that are still landing in the same namespace.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult f790bae8dc Xnamespace: initial config loader
This loads the configuration (simple text file) passed via command line.
For now just supporting static configuration, that's loaded on server
startup.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 9c4b4e54d1 Xnamespace: property access hook
Filter property access. Right now just allowed inside same namespace,
or when caller is in root namespace.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 21e890e5fc Xnamespace: whitelist access to some server resources
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 8df9373199 Xnamespace: whitelist some XI operations
Whitelisting some XI operations in various hooks.

Note that some additional filtering needs to be done in send or
receive hook in order to prevent clients to receive possibly sensible
input data from the root window.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 0a90e70a01 Xnamespace: filter access on other clients
Restrict access to other clients within same namespace.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult e92d6ad8e4 Xnamespace: filter client-to-client message sending
Filter message sending by clients. Only sending within the same
namespace is allowed (except for clients in a NS with superpowers,
e.g. root)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 5a2903901a Xnamespace: filter server access
Whitelisting several server access calls that are safe, rejecting the rest.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult e293308ef7 Xnamespace: filter device access
Filter device access, whitelist several commonly used operations that
should be safe (eg. query keyboard layout).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 7afdba1952 Xnamespace: whitelist access to namespace virtual root window
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult fdba5d405d Xnamespace: whitelist certain operations on (real) root window
CreateWindow() needs access to root window, in order to create
top level windows. Whitelisting this operation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult df56b26ed4 Xnamespace: whitelist resource access for serverClient
The server itself is allowed to access anything w/o restrictions.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult eaa08af7d1 Xnamespace: whitelist resource access within same namespace
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 86dd87d46c Xnamespace: filter transparency
Silently drop transparency flag if namespace isn't allowed to use 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 14008eb698 Xnamespace: filter extension access
Whitelist several extension calls that are safe. Also allow namespaces
to be configured for unrestricted access.

TBD: doesn't actually reject yet

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 81faed9c8c Xnamespace: filter raw mouse motion and keyboard access
Only namespaces with allowMouseOption flag enabled can receive
raw mouse motion events. Raw key press events are always blocked.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult cb1baec84a Xnamespace: isolate root window property access
Redirecting access to root window properties to the per-namespace
virtual root windows. This isolates a lot of communication via root
window, e.g. the cut buffers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 159183c8a0 Xnamespace: create per-namespace fake root windows
For each namespace creating a fake (invisible) root window, which can be
used for storing per-namespace properties (eg. cut buffers), etc.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 5901cb001d Xnamespace: add selection isolation
Selection names (as seen by the client) are internally prefixed with the
namespace ID, so each client can only access those within it's namespace.

If a client within namespace "foo" want's to operate on "PRIMARY",
it actually will be doing so on "<foo>PRIMARY", w/o ever noticing it.
Events will sent back to the client still pointing to "PRIMARY".

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 0698743fde Xnamespace: assign incoming clients to namespaces
The association is done by matching client's and namespace's
authentication token.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 9f8ef921ad Xnamespace: add basic namespace config structures
Adding data structure and initial data for namespace configuration.

Built-in namespaces are ROOT and ANONYMOUS.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 4379f7cc87 Xnamespace: namespace extension skeleton
Add tiny skeleton for the namespace extension. Disabled by default,
can be enabled via +extension arg, but doesn't actually do something yet.

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 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 7c51bcb093 os: unexport internal logging functions
Lots of logging functions, especially init and teardown aren't called
by any drivers/modules, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult 9a82f5c30b drop remains of cygwin support
Cygwin support doesn't seem to be used anymore, so it can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult da7197d5d2 dix: move over private defintions from selection.h to private header
Move over private definitions to a new private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult 3c028a8cc0 miext: move over extinit_priv.h from include
Since most of the extension init logic (and on/off switches for them)
is driven from miext, this seems the appropriate place for the header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult 6db12450fe Xext: xf86bigfont: unexport noXFree86BigfontExtension
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:45 +02:00
Enrico Weigelt, metux IT consult 592d8fe8f5 Xext: security: unexport noSecurityExtension
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:45 +02:00
Enrico Weigelt, metux IT consult a79dd9b264 Xext: shm: move client local check into procs
Move extra complexity out of the dispatch functions, so they're
really just switch/case statements calling the actual handler procs.
Preparation for further steps.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:45 +02:00
Enrico Weigelt, metux IT consult c67b05e653 Xext: shm: simplify dispatcher
These dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:45 +02:00
Enrico Weigelt, metux IT consult 850da1ad5f xace: export XaceRegisterCallback() and XaceDeleteCallback()
Allow drivers to use Xace as a clean way for retrieving property updates.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:45 +02:00
Enrico Weigelt, metux IT consult 638efbc06c Xext: xf86bigfont: drop unncessary zero assignments
When using static struct initialization, fields not explicitly
stated are automatically zero.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:45 +02:00
Enrico Weigelt, metux IT consult 9ef5fc9a29 Xext: vidmode: untwist ProcVidModeGetAllModeLines() and use stack buffer
The ProcVidModeGetAllModeLines() is a bit complicated, because reply structs
differ depending the active protocol version. In order to make it easier to
understand and allow further simplification of the request/reply marshalling
(see ticket #1701), splitting the two protocol versions into separate functions.

Also collecting the whole payload in a stack buffer (size is already known
anyways), in order to save arbirary number of individual WriteToClient() calls,
but send out the whole reply in one pass, which in turn allows further
simplifications in the sending path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:44 +02:00
Enrico Weigelt, metux IT consult 285610b283 Xext: vidmode: ProcVidModeSetGammaRamp() simplify payload write out
WriteToClient() already checks for zero-length buffer and does nothing
in that case. So we can make the code a bit easier to read and also
allow further simplification of reply submission by upcoming commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:44 +02:00
Enrico Weigelt, metux IT consult 9b661813f1 Xext: vidmode: ProcVidModeSetGammaRamp() clean up length computation
Make computation of reply length a bit easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:44 +02:00
Enrico Weigelt, metux IT consult 5c12c7ad53 Xext: vidmode: ProcVidModeSetGammaRamp() declare variables where needed
Make the code a bit easier to understand by declaring the variables
where they're first used instead of at the very top of the function.

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