XLibre Xserver
Go to file
Mario Kleiner f467f85ca1 Fix RandR leasing for more than 1 simultaneously active lease.
Due to a switched order of parameters in the xorg_list_add()
call inside ProcRRCreateLease(), adding a new lease for RandR
output leasing does not actually add the new RRLeasePtr lease
record to the list of existing leases for a X-Screen, but instead
replaces the existing list with a new list that has the new lease
as the only element, and probably leaks a bit of memory.

Therefore the server "forgets" all active leases for a screen,
except for the last added lease. If multiple leases are created
in a session, then destruction of all leases but the last one
will fail in many cases, e.g., during server shutdown in
RRCloseScreen(), or resource destruction, e.g., in
RRCrtcDestroyResource().

Most importantly, it fails if a client simply close(fd)'es the
DRM master descriptor to release a lease, quits, gets killed or
crashes. In this case the kernel will destroy the lease and shut
down the display output, then send a lease event via udev to the
ddx, which e.g., in the modesetting-ddx will trigger a call to
drmmode_validate_leases().

That function is supposed to detect the released lease and tell
the server to terminate the lease on the server side as well,
via xf86CrtcLeaseTerminated(), but this doesn't happen for all
the leases the server has forgotten. The end result is a dead
video output, as the server won't reinitialize the crtc's
corresponding to the terminated but forgotten lease.

This bug was observed when using the amdvlk AMD OSS Vulkan
driver and trying to lease multiple VKDisplay's, and also
under Mesa radv, as both Mesa Vulkan/WSI/Display and amdvlk
terminate leases by simply close()ing the lease fd, not by
sending explicit RandR protocol requests to free leases.

Leasing worked, but ending a session with multiple active
leases ended in a lot of unpleasant darkness.

Fixing the wrong argument order to xorg_list_add() fixes the
problem. Tested on single-X-Screen and dual-X-Screen setups,
with one, two or three active leases.

Please merge this for the upcoming server 21.1 branch.
Merging into server 1.20 would also make a lot of sense.

Fixes: e4e3447603
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Keith Packard <keithp@keithp.com>
2021-10-19 09:19:28 +02:00
.gitlab-ci ci: Install libxcvt from git 2021-08-06 11:29:29 +00:00
Xext selinux: Stop using security_context_t 2021-08-17 16:02:39 -04:00
Xi xinput: Silence a warning from gcc 11 2021-08-17 16:02:44 -04:00
composite meson: hide C API if Xorg is disabled (like autotools) 2021-03-11 00:22:36 +00:00
config config: Fix platform busid parsing when there is no ID_PATH prop 2021-06-25 13:24:51 +03:00
damageext More missing version checks in SProcs 2021-08-08 12:43:01 +00:00
dbe meson: hide C API if Xorg is disabled (like autotools) 2021-03-11 00:22:36 +00:00
dix dix/privates.c: Avoid undefined behaviour after realloc() 2021-10-08 09:59:11 +00:00
doc meson: Implement developer documentation build 2021-08-20 10:26:07 +00:00
dri3 meson: hide C API if Xorg is disabled (like autotools) 2021-03-11 00:22:36 +00:00
exa exa: rename some badly named variables 2020-07-10 06:17:40 +10:00
fb meson: hide C API if Xorg is disabled (like autotools) 2021-03-11 00:22:36 +00:00
glamor glamor: Assume EGL in glamor_context 2021-09-15 19:14:23 +00:00
glx glx: Fix use after free in MakeCurrent 2021-06-21 08:39:38 +02:00
hw xwayland: Notify of root size change with XRandR emulation 2021-10-12 08:05:47 +00:00
include Use EGL_LINUX_DMA_BUF_EXT to create GBM bo EGLImages 2021-10-05 14:12:16 -07:00
m4 Add ax_pthread.m4 to m4/ 2016-05-29 19:20:51 -07:00
man Drop DMX DDX 2021-09-07 09:34:31 +00:00
mi Implement gesture processing logic 2021-05-30 13:26:42 +03:00
miext miext: Remove if check which is always true 2021-03-26 09:02:14 +00:00
os os: Try to discover the current seat with the XDG_SEAT var first 2021-10-14 10:35:43 +00:00
present Don't hardcode fps for fake screen 2021-07-29 08:09:00 +00:00
pseudoramiX Unvalidated lengths 2017-10-10 23:33:34 +02:00
randr Fix RandR leasing for more than 1 simultaneously active lease. 2021-10-19 09:19:28 +02:00
record Fix XRecordRegisterClients() Integer underflow 2020-08-25 17:01:29 +02:00
render xserver: fix RGB mask handling 2021-04-16 14:40:49 +00:00
test xfree86: Use libxcvt 2021-08-06 11:29:29 +00:00
xfixes XFixes: add version check for byteswapped clients 2021-08-06 11:12:40 -04:00
xkb xkb: Drop check for XkbSetMapResizeTypes 2021-10-07 14:17:26 +00:00
.appveyor.yml Drop DMX DDX 2021-09-07 09:34:31 +00:00
.dir-locals.el .dir-locals.el: Add missing final newline 2019-10-01 17:05:28 +00:00
.gitignore .gitignore: Add new autotools file 'test-driver' 2014-04-21 13:41:42 -07:00
.gitlab-ci.yml ci: Install libxcvt from git 2021-08-06 11:29:29 +00:00
.travis.yml travis: Add OSX meson build to matrix 2019-05-02 15:42:58 +00:00
COPYING modesetting: Merge modesetting's COPYING into the xserver's. 2014-09-15 12:46:02 -07:00
Makefile.am Drop DMX DDX 2021-09-07 09:34:31 +00:00
README.md Fix spelling/wording issues 2020-07-05 13:07:33 -07:00
autogen.sh autogen: Set a default subject prefix for patches 2016-02-08 17:41:38 -05:00
configure.ac Use EGL_LINUX_DMA_BUF_EXT to create GBM bo EGLImages 2021-10-05 14:12:16 -07:00
devbook.am doc: Create a script to filter xmlto output 2015-01-05 14:24:06 -08:00
docbook.am docbook.am: embed css styles inside the HTML HEAD element 2011-09-21 14:07:49 -07:00
manpages.am man: Fix automake seddery 2018-05-08 12:15:30 -04:00
meson.build meson: Implement developer documentation build 2021-08-20 10:26:07 +00:00
meson_options.txt Drop DMX DDX 2021-09-07 09:34:31 +00:00
xorg-server.m4 xorg-server.m4: just all cflags instead of just sdkdir 2018-09-20 20:12:24 +01:00
xorg-server.pc.in xfree86: link modules against Xorg symbols on Cygwin 2012-04-05 21:57:07 -05:00
xserver.ent.in doc: relocate xserver.ent in the package root directory 2011-05-14 11:22:26 -07:00

X Server

The X server accepts requests from client applications to create windows, which are (normally rectangular) "virtual screens" that the client program can draw into.

Windows are then composed on the actual screen by the X server (or by a separate composite manager) as directed by the window manager, which usually communicates with the user via graphical controls such as buttons and draggable titlebars and borders.

For a comprehensive overview of X Server and X Window System, consult the following article: https://en.wikipedia.org/wiki/X_server

All questions regarding this software should be directed at the Xorg mailing list:

https://lists.freedesktop.org/mailman/listinfo/xorg

The primary development code repository can be found at:

https://gitlab.freedesktop.org/xorg/xserver

For patch submission instructions, see:

https://www.x.org/wiki/Development/Documentation/SubmittingPatches

As with other projects hosted on freedesktop.org, X.Org follows its Code of Conduct, based on the Contributor Covenant. Please conduct yourself in a respectful and civilized manner when using the above mailing lists, bug trackers, etc:

https://www.freedesktop.org/wiki/CodeOfConduct