From 8d307d4e6d9e0c0bdaf7b7a527f74cc8f9dd91db Mon Sep 17 00:00:00 2001 From: lingsheng <860373352@qq.com> Date: Mon, 25 Nov 2024 05:45:16 +0000 Subject: [PATCH] xfree86: fbdevhw: fix pci detection on recent Linux (cherry picked from commit 98f92df913334017c8821523edddc97012545285) --- ...hw-fix-pci-detection-on-recent-Linux.patch | 54 +++++++++++++++++++ xorg-x11-server.spec | 6 ++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 backport-xfree86-fbdevhw-fix-pci-detection-on-recent-Linux.patch diff --git a/backport-xfree86-fbdevhw-fix-pci-detection-on-recent-Linux.patch b/backport-xfree86-fbdevhw-fix-pci-detection-on-recent-Linux.patch new file mode 100644 index 0000000..c4dd5de --- /dev/null +++ b/backport-xfree86-fbdevhw-fix-pci-detection-on-recent-Linux.patch @@ -0,0 +1,54 @@ +From 728b54528d37ffa27b07c9b181c5ed8d2d359379 Mon Sep 17 00:00:00 2001 +From: Tj +Date: Fri, 19 Jul 2024 19:50:56 +0200 +Subject: [PATCH] xfree86: fbdevhw: fix pci detection on recent Linux + +Linux kernel v6.9 has changed the symlink to point to the parent device. This +breaks fbdev_open() detection logic. Change it to use the subsystem symlink +instead which will remain stable. + +Kernel v6.8: + +[ 14.067] (II) fbdev_open() sysfs_path=/sys/class/graphics/fb0 +[ 14.067] (II) fbdev_open() buf=../../devices/platform/vesa-framebuffer.0/graphics/fb0 + +Kernel v6.9: + +[ 15.609] (II) fbdev_open() sysfs_path=/sys/class/graphics/fb0 +[ 15.609] (II) fbdev_open() buf=../../devices/pci0000:00/0000:00:01.0/vesa-framebuffer.0/graphics/fb0 + +Originally found in automated Debian ISO QA testing [0] and confirmed in Linux [1]. + +Tested on kernels v6.9.7 and v6.8.12 + +[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075713 +[1] https://lore.kernel.org/lkml/lLyvPFC_APGHNfyGNHRpQy5izBikkaTPOpHooZIT3fFAoJPquSI31ZMueA99XTdr8ysir3X7O7IMdc6za-0m79vr_claeparHhoRouVgHOI=@proton.me/ + +Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1714 +Signed-off-by: Tj +Reviewed-by: Thomas Zimmermann +Reviewed-by: Enrico Weigelt, metux IT consult +Part-of: +--- + hw/xfree86/fbdevhw/fbdevhw.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c +index 1e39c81469..92cac3f4af 100644 +--- a/hw/xfree86/fbdevhw/fbdevhw.c ++++ b/hw/xfree86/fbdevhw/fbdevhw.c +@@ -378,9 +378,9 @@ fbdev_open(int scrnIndex, const char *dev, char **namep) + char *sysfs_path = NULL; + char *node = strrchr(dev, '/') + 1; + +- if (asprintf(&sysfs_path, "/sys/class/graphics/%s", node) < 0 || ++ if (asprintf(&sysfs_path, "/sys/class/graphics/%s/device/subsystem", node) < 0 || + readlink(sysfs_path, buf, sizeof(buf)) < 0 || +- strstr(buf, "devices/pci")) { ++ strstr(buf, "bus/pci")) { + free(sysfs_path); + close(fd); + return -1; +-- +GitLab + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 126679d..a28a243 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -16,7 +16,7 @@ Name: xorg-x11-server Version: 1.20.11 -Release: 34 +Release: 35 Summary: X.Org X11 X server License: MIT and GPLv2 URL: https://www.x.org @@ -131,6 +131,7 @@ Patch6044: backport-0001-CVE-2023-5574.patch Patch6045: backport-0002-CVE-2023-5574.patch Patch6046: backport-0003-CVE-2023-5574.patch Patch6047: backport-CVE-2024-9632.patch +Patch6048: backport-xfree86-fbdevhw-fix-pci-detection-on-recent-Linux.patch BuildRequires: audit-libs-devel autoconf automake bison dbus-devel flex git gcc BuildRequires: systemtap-sdt-devel libtool pkgconfig @@ -472,6 +473,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %{_mandir}/man*/* %changelog +* Mon Nov 25 2024 lingsheng - 1.20.11-35 +- xfree86: fbdevhw: fix pci detection on recent Linux + * Mon Nov 04 2024 wangkai <13474090681@163.com> - 1.20.11-34 - Fix CVE-2024-9632 -- Gitee