commit: 632db727dc0c879fa4eb1aedcb747d9a9265d330 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon Dec 5 10:17:44 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Dec 5 10:19:33 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=632db727
x11-base/xorg-server: backport BadIDChoice fix w/ MaxClients I was hoping this would slip into a release but it hasn't yet. In any case, this fix has been on master for a while & I've been running with it for months. Closes: https://bugs.gentoo.org/857483 Closes: https://bugs.gentoo.org/875977 Signed-off-by: Sam James <sam <AT> gentoo.org> .../files/xorg-server-21.1.4-BadIDChoice.patch | 59 ++++++++++++++++++++++ ...er-9999.ebuild => xorg-server-21.1.4-r1.ebuild} | 7 ++- x11-base/xorg-server/xorg-server-9999.ebuild | 2 +- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/x11-base/xorg-server/files/xorg-server-21.1.4-BadIDChoice.patch b/x11-base/xorg-server/files/xorg-server-21.1.4-BadIDChoice.patch new file mode 100644 index 000000000000..def3c58714b4 --- /dev/null +++ b/x11-base/xorg-server/files/xorg-server-21.1.4-BadIDChoice.patch @@ -0,0 +1,59 @@ +https://bugs.gentoo.org/857483 +https://gitlab.freedesktop.org/xorg/xserver/-/issues/1310 +https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/953 + +From f61307631203ab0266c035db07c2f776cf7c6cf4 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan <[email protected]> +Date: Tue, 12 Jul 2022 14:44:48 +0200 +Subject: [PATCH] dix: Fix overzealous caching of ResourceClientBits() + +Commit c7311654 cached the value of ResourceClientBits(), but that value +depends on the `MaxClients` value set either from the command line or +from the configuration file. + +For the latter, a call to ResourceClientBits() is issued before the +configuration file is read, meaning that the cached value is from the +default, not from the maximum number of clients set in the configuration +file. + +That obviously causes all sort of issues, including memory corruption +and crashes of the Xserver when reaching the default limit value. + +To avoid that issue, also keep the LimitClient value, and recompute the +ilog2() value if that changes, as on startup when the value is set from +the the xorg.conf ServerFlags section. + +v2: Drop the `cache == 0` test + Rename cache vars + +Fixes: c7311654 - dix: cache ResourceClientBits() value +Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1310 +Signed-off-by: Olivier Fourdan <[email protected]> +Reviewed-by: Adam Jackson <[email protected]> +(cherry picked from commit 2efa6d659508346358a1ef27b2393e18843f66a3) +--- a/dix/resource.c ++++ b/dix/resource.c +@@ -620,12 +620,15 @@ ilog2(int val) + unsigned int + ResourceClientBits(void) + { +- static unsigned int cached = 0; ++ static unsigned int cache_ilog2 = 0; ++ static unsigned int cache_limit = 0; + +- if (cached == 0) +- cached = ilog2(LimitClients); ++ if (LimitClients != cache_limit) { ++ cache_limit = LimitClients; ++ cache_ilog2 = ilog2(LimitClients); ++ } + +- return cached; ++ return cache_ilog2; + } + + /***************** +-- +GitLab + + diff --git a/x11-base/xorg-server/xorg-server-9999.ebuild b/x11-base/xorg-server/xorg-server-21.1.4-r1.ebuild similarity index 96% copy from x11-base/xorg-server/xorg-server-9999.ebuild copy to x11-base/xorg-server/xorg-server-21.1.4-r1.ebuild index 316e0c3ba53c..85f83743b7ff 100644 --- a/x11-base/xorg-server/xorg-server-9999.ebuild +++ b/x11-base/xorg-server/xorg-server-21.1.4-r1.ebuild @@ -44,7 +44,7 @@ CDEPEND=" >=x11-libs/libX11-1.1.5 ) xephyr? ( - x11-libs/libxcb[xkb] + x11-libs/libxcb x11-libs/xcb-util x11-libs/xcb-util-image x11-libs/xcb-util-keysyms @@ -95,6 +95,11 @@ REQUIRED_USE="!minimal? ( elogind? ( udev ) ?? ( elogind systemd )" +UPSTREAMED_PATCHES=( + # https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/953 + "${FILESDIR}"/${PN}-21.1.4-BadIDChoice.patch +) + PATCHES=( "${UPSTREAMED_PATCHES[@]}" "${FILESDIR}"/${PN}-1.12-unloadsubmodule.patch diff --git a/x11-base/xorg-server/xorg-server-9999.ebuild b/x11-base/xorg-server/xorg-server-9999.ebuild index 316e0c3ba53c..b70fa161d379 100644 --- a/x11-base/xorg-server/xorg-server-9999.ebuild +++ b/x11-base/xorg-server/xorg-server-9999.ebuild @@ -44,7 +44,7 @@ CDEPEND=" >=x11-libs/libX11-1.1.5 ) xephyr? ( - x11-libs/libxcb[xkb] + x11-libs/libxcb x11-libs/xcb-util x11-libs/xcb-util-image x11-libs/xcb-util-keysyms
