xserver/os
Twaik Yont 986202ce4d 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>
(cherry picked from commit 5568b0f83f)
(cherry picked from commit 59673c0503)
2026-03-24 16:05:35 +01:00
..
.gitignore dix and os: gitignore dix.O and os.O 2011-09-23 17:14:47 -07:00
access.c os: Fix NULL pointer dereference 2024-09-24 11:33:13 +02:00
alloc.c os: move alloc functions to separate source file 2024-02-29 10:09:37 +00:00
auth.c os: move mitauth prototypes to separate header 2024-02-22 23:42:52 +00:00
auth.h os: move Auth* function types to separate header 2024-02-22 23:42:53 +00:00
backtrace.c Fix missing include of <sys/wait.h> 2024-03-18 23:02:45 +00:00
busfault.c os: Fix iteration over busfaults 2017-02-23 09:20:48 +10:00
client.c Return NULL in *cmdname if the client argv or argv[0] is NULL 2024-09-24 10:47:54 +02:00
connection.c os: use close-on-exec for X server socket to prevent fd leaks 2026-03-24 16:05:35 +01:00
fmt.c os: move out Format*() functions 2024-03-09 17:34:51 +00:00
fmt.h os: move out Format*() functions 2024-03-09 17:34:51 +00:00
inputthread.c os, shm: fcntl()'s third argument is integer, not pointer 2020-12-18 09:36:30 -05:00
io.c dix: unexport global variables 2024-03-09 17:23:43 +00:00
log.c os: move out Format*() functions 2024-03-09 17:34:51 +00:00
meson.build os: move out Format*() functions 2024-03-09 17:34:51 +00:00
mitauth.c os: move mitauth prototypes to separate header 2024-02-22 23:42:52 +00:00
mitauth.h os: move Auth* function types to separate header 2024-02-22 23:42:53 +00:00
oscolor.c os: color: fix possible buffer overflow vulnerability 2024-02-22 23:33:34 +00:00
osdep.h os: Explicitly include X11/Xmd.h for CARD32 definition to fix building on i686 2024-07-04 08:36:40 +00:00
osinit.c os: consolidate busfault handling 2024-02-23 23:15:12 +00:00
ospoll.c ospoll: Fix Solaris ports implementation to build on Solaris 11.4 2019-09-23 15:12:01 -07:00
ospoll.h os: Add ospoll interface [v2] 2016-07-21 15:04:47 -04:00
reallocarray.c Import reallocarray() from OpenBSD 2015-04-21 16:57:08 -07:00
rpcauth.c os: rpc: fix type mismatch 2024-03-21 22:57:40 +00:00
rpcauth.h os: move Auth* function types to separate header 2024-02-22 23:42:53 +00:00
strcasecmp.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
strcasestr.c os: fix mising prototype / include on WIN32 builds 2024-03-03 23:02:54 +00:00
string.c os: move string functions to separate source file 2024-02-29 10:09:37 +00:00
strlcat.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
strlcpy.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
strndup.c os: Ensure <dix-config.h> is included in strndup.c 2013-02-14 09:20:46 -08:00
timingsafe_memcmp.c timingsafe_memcmp: Fix meson build 2017-05-10 10:56:16 -04:00
utils.c os: move SELinux enforcement state to the extension 2024-03-25 19:40:04 +00:00
WaitFor.c os: NextDPMSTimeout: mark intentional fallthroughs in switch 2025-02-04 09:17:35 +01:00
xdmauth.c os: move xdmauth prototypes to separate header 2024-02-22 23:42:52 +00:00
xdmauth.h os: move Auth* function types to separate header 2024-02-22 23:42:53 +00:00
xdmcp.c os: fix missing include of <errno.h> 2024-03-21 17:32:30 +01:00
xdmcp.h Fix build with -Dxdmcp=false 2024-02-25 11:55:56 +01:00
xprintf.c Remove "All rights reserved" from Oracle copyright notices 2023-02-25 09:40:41 -08:00
xserver_poll.c os: Fix build of xserver_poll.c on MinGW 2019-05-18 14:59:38 +00:00
xsha1.c include: move xsha1.h to os/ 2024-03-03 23:11:05 +00:00
xsha1.h include: move xsha1.h to os/ 2024-03-03 23:11:05 +00:00
xstrans.c Clean up a couple of warnings in os/ 2013-10-31 16:58:12 -07:00