Commit Graph

1054 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
8c3d608d4e os: xserver_poll: skip defining symbols already defined by mingw
mingw already has struct pollfd and POLL* defines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 15:28:08 +02:00
Enrico Weigelt, metux IT consult
9fdb2482de os: xtrans: drop define of EINPROGRESS
Never used anywhere and conflicts with system headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 15:24:30 +02:00
Enrico Weigelt, metux IT consult
90d0c2d4a0 os: xtrans: drop unused TRANS_CLOSEONEXEC
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 15:23:27 +02:00
Enrico Weigelt, metux IT consult
d9db02d700 os: ospoll: use stdbool instead of X11's Bool
Low level OS specific code should not depend on higher level protocol
headers. This also removes yet another conflict with win32/mingw headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 15:22:07 +02:00
Enrico Weigelt, metux IT consult
93f57f68a2 os: xserver_poll: replace own typedef by size_t
No need to have an own typedef here, just use standard size_t.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 14:50:05 +02:00
Enrico Weigelt, metux IT consult
e1b1c2f514 os: ospoll: use realloc() instead of reallocarray()
MacOS doesn't support reallocarray(), and we can't include os.h here
on win32/mingw.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 14:49:23 +02:00
Enrico Weigelt, metux IT consult
8299ef3d81 os: xtrans: fix shadowed variable
`arg` is also a parameter of that functions, so we really shouldn't
also have a local variable by the same name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-30 20:40:51 +02:00
Enrico Weigelt, metux IT consult
53691f7174 os: xtranssock: undefine before redefining EADDRINUSE
prevent warning on doubly defined preprocessor symbol.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-30 19:09:44 +02:00
Enrico Weigelt, metux IT consult
9986e17950 meson: move MAXCLIENTS and LIMITCLIENTS into dix-config.h
Both are potentially tunable variables, and MAXCLIENTS is (still) used by
intel-driver, but also by os specific parts that must not include misc.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-30 14:55:40 +02:00
Oleh Nykyforchyn
0c23d26fb8 xserver: os/log.c: ignore alternate forms in log formats
This patch fixes Xserver crashes when evdev or synaptics input drivers are used.
These (and maybe other) driver use alternate forms "%#..." in formats for
xf86IDrvLogVerb() function, which in turn uses signal-safe vpnprintf().
The last function does not recognize alternate forms and exits abnormally, which
causes Xserver to crash. The patch make vpnprintf() to ignore alternate forms.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2025-07-29 16:21:02 +02:00
Enrico Weigelt, metux IT consult
879bc0012d os: xdmcp: fix missing include of <X11/Xdmcp.h>
xdmcp.h is using types from <X11/Xdmcp.h>, but forgot to include it.
This just popped up with building w/ -Dxdmcp=false, because that file was
included in the wrong place (osdep.h) and only conditionally.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-28 16:20:58 +02:00
Enrico Weigelt, metux IT consult
296e7cb842 os: ospoll: add missing include of <assert.h>
We're using assert() here, so need to include <assert.h>

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-25 16:20:52 +02:00
Enrico Weigelt, metux IT consult
31c75dd68b os: ospoll: add missing include of <string.h>
Needed for memmove()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-25 16:20:27 +02:00
Enrico Weigelt, metux IT consult
1292b4bd39 os: ospoll: drop not needed including of X11 headers
Those just conflicting with win32/mingw headers on type `BOOL`.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-25 16:10:01 +02:00
Enrico Weigelt, metux IT consult
2bee97548e os: move X_NOTIFY_* defines to separate header
These defines are already public, used by consumers of SetNotifyFd(),
but also needed in places where os.h cannot be included.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-25 15:21:13 +02:00
Enrico Weigelt, metux IT consult
4fa6849f43 os: xtrans: drop define of EPROTOTYPE
Never used anywhere and conflicts with system headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-25 12:44:14 +02:00
Enrico Weigelt, metux IT consult
ee1f0a3ac4 os: xtrans: drop define of ECONNREFUSED
Never used anywhere and conflicts with system headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-25 12:30:12 +02:00
Enrico Weigelt, metux IT consult
4ee55d09b0 os: xtrans: fix _XSERVTransWSAStartup() prototype
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-25 09:56:31 +02:00
Enrico Weigelt, metux IT consult
f0cc20eb68 os: osdep: add macro for compile-time type size assert
usage:

   __size_assert(typename, size);

if the type's size (calculated by sizeof) doesn't match the asserted size,
an illegal dummy type will be constructed, thus compilation fails.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-19 02:38:26 +02:00
Enrico Weigelt, metux IT consult
f5062223ec os: xtrans: fix calloc overflow warning
The size of `int` is machine specific and may be 64 bits wide, which could
overflow the calloc'able size. Practically cannot happen here, since the
ListenTransCount can't go above MAX_CONNECTIONS, but compiler can't know
that and so spitting out a warning.

Using uint32_t really is sufficient here.

> ../os/connection.c: In function ‘CreateWellKnownSockets’:
> ../os/connection.c:274:22: warning: argument 1 range [18446744071562067968, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
>   274 |     ListenTransFds = calloc(ListenTransCount, sizeof(int));
>       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
d1bb5dc457 os: xtrans: expand TRANS() macro to _XSERVTrans
Since TRANS() now will always expand the same, it's better for
maintenance, having the function names written explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
689351067c os: xtrans: drop GetReopenInfo()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
80d1cb5095 os: xtrans: drop ifdefs on NAMEDNODENAME
It's always defined, so no ifdefs needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
f7a1627659 os: xtrans: drop DEV_PTMX
Not used anywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
03653eb403 os: xtrans: drop TRANS_CLIENT code pathes
Not needed in server-only code base.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
a830e4eff5 os: xtrans: drop XSERV_t and x11_t defines
These are always enablde (x11_t is defined when XSERV_t is defined),
so no need for the #ifdef's anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
499751751d os: xtrans: drop ifdef TRANS_REOPEN
It's always defined, so the guards aren't necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
b17fe4128b os: xtrans: drop ifdef TRANS_SERVER
it's always defined, no extra guards needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
1f49e6ae8f os: xtrans: drop NEED_UTSNAME
All our supported platforms have this utsname.h.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
fb5f76f856 os: xtrans: drop _WILLWINSOCK_
Not used anywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
214e1c0ca1 os: xtrans: drop own VErrorF() and ErrorF()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
16053efd50 os: xtrans: replace bzero by memset
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
4ca4c167ff os: xtrans: drop XIM_t
Not defined anywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
882d4d440a os: xtrans: drop FS_t
Not defined anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
18a459340c os: xtrans: drop FONT_t
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
8df9d118a0 os: xtrans: drop ICE_t
Not used anywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
a9973073c0 os: xtrans: drop GetMyNetworkId()
Not used anywhere, so lets drop it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
9156f28be1 os: xtrans: drop unused GetPeerNetworkId()
Not used anywhere, so let's drop it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
930f2d6f15 os: xtrans: drop X_NO_SYS_UN
Not defined anywhere, so no need to check for it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
d5d19ac6f0 os: use internal xtrans instead of external library
Now that we've got xtrans bundled in our source tree, use this one and
drop the external dependency.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/691
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
cd81370e9d os: incorporate xtrans xtrans-1.6.0
Copy over from xtrans package, tag xtrans-1.6.0

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
240e471325 os: use NULL instead of NullClient
No need to have another name for NULL, we can use NULL directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:24:55 +02:00
Enrico Weigelt, metux IT consult
e3ef0bd5c3 os: osdep.h: drop using HAVE_DIX_CONFIG_H
This symbol is always defined, and the header is always present,
so no need to check for it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 04:51:31 +02:00
Enrico Weigelt, metux IT consult
ce89617074 os: move probes.h and rename it to probes_priv.h
Private headers should not be in public include directory.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 04:51:30 +02:00
dasha_uwu
7c64a06ba4 treewide: remove "lib" prefix in static_library names (meson)
this was producing static libraries named "liblibsomething.a"

Signed-off-by: dasha_uwu <dasha@linuxping.win>
2025-07-03 12:01:52 +02:00
Enrico Weigelt, metux IT consult
4036b8c163 os: log: vpnprintf(): ignore reverse justification modifier
The only caller is libinput, and we don't really need it, just silencing
bug message.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-01 17:15:56 +02:00
Enrico Weigelt, metux IT consult
13595b1801 xfree86: export OsBlockSignals() but keep it internal
Needed by the int10 module, so has to be in the symbol table.
But still not supposed to be used by out-of-tree drivers.

Reported-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-20 18:36:29 +02:00
Enrico Weigelt, metux IT consult
905329940a xfree86: export OsReleaseSignals() but keep it internal
Needed by the int10 module, so has to be in the symbol table.
But still not supposed to be used by out-of-tree drivers.

Reported-by: stefan11111 <stefan11111@shitposting.expert>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-20 18:36:29 +02:00
Olivier Fourdan
899afa4c10 os: Check for integer overflow on BigRequest length
Check for another possible integer overflow once we get a complete xReq
with BigRequest.

Related to CVE-2025-49176

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Suggested-by: Peter Harris <pharris2@rocketsoftware.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2028>
2025-06-18 17:51:36 +02:00
Olivier Fourdan
0d6af5a542 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 20:01:25 +02:00