fix CVE-2026-128885 #116
Open
zhangtao99Add on 5 days ago
Total: 2 files changed+137-1
@@ -0,0 +1,132 @@
1+From dab3fee27affab37c97a8323a36385ed818f3562 Mon Sep 17 00:00:00 2001
2+From: Simon McVittie <smcv@collabora.com>
3+Date: Tue, 3 Nov 2026 16:12:45 +0000
4+Subject: [PATCH] sysdeps-unix: Make _dbus_poll() emulate poll() more
5+ accurately
6+ 
7+An LLM-based code audit by AISLE in partnership with Red Hat reported
8+that on Unix platforms where _dbus_poll() calls select(), if an attacker
9+can induce dbus-daemon to allocate 1024 or more fds, then they can cause
10+a stack buffer overflow that will most likely crash the dbus-daemon,
11+which in principle is a denial-of-service vulnerability.
12+ 
13+In practice we believe this will only happen on macOS and Interix (for
14+the reasons described in dbus-sysdeps.h by commit 0414ea65), plus our
15+"legacy" CI build which intentionally pretends that poll() doesn't work
16+in order to get test coverage on this code path.
17+ 
18+According to POSIX, negative fds result in no events being returned.
19+I don't know whether dbus actually relies on this behaviour (I suspect
20+that it does not) but let's emulate it faithfully.
21+ 
22+Similarly, invalid fds are represented by POLLNVAL. Let's use that
23+representation for fds that are outside the range that can be polled
24+successfully by a select()-based emulation. We already know that users
25+of _dbus_poll() have to be able to cope with this, for the case where
26+_dbus_poll() is implemented as poll().
27+ 
28+Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/work_items/584
29+Bug-RedHat: https://redhat.atlassian.net/browse/RHEL-239610
30+Signed-off-by: Simon McVittie <smcv@collabora.com>
31+(cherry picked from commit 282b3fa1fae234c978ef382f88d75eb5ac00b076)
32+---
33+ dbus/dbus-sysdeps-unix.c | 57 ++++++++++++++++++++++++++++++++++++++--
34+ 1 file changed, 55 insertions(+), 2 deletions(-)
35+ 
36+diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
37+index 72608ef4c..d8c1c192c 100644
38+--- a/dbus/dbus-sysdeps-unix.c
39++++ b/dbus/dbus-sysdeps-unix.c
40+@@ -3389,7 +3389,7 @@ _dbus_poll (DBusPollFD *fds,
41+ int max_fd = 0;
42+ int i;
43+ struct timeval tv;
44+- int ready;
45++ int ready = 0;
46+
47+ FD_ZERO (&read_set);
48+ FD_ZERO (&write_set);
49+@@ -3399,6 +3399,20 @@ _dbus_poll (DBusPollFD *fds,
50+ {
51+ DBusPollFD *fdp = &fds[i];
52+
53++ fdp->revents = 0;
54++
55++ /* poll(2) documents that fd < 0 is ignored
56++ * (no events will be reported) */
57++ if (fdp->fd < 0)
58++ continue;
59++
60++ if (fdp->fd >= FD_SETSIZE)
61++ {
62++ fdp->revents = _DBUS_POLLNVAL;
63++ ready++;
64++ continue;
65++ }
66++
67+ if (fdp->events & _DBUS_POLLIN)
68+ FD_SET (fdp->fd, &read_set);
69+
70+@@ -3410,19 +3424,58 @@ _dbus_poll (DBusPollFD *fds,
71+ max_fd = MAX (max_fd, fdp->fd);
72+ }
73+
74++ if (ready > 0)
75++ return ready;
76++
77+ tv.tv_sec = timeout_milliseconds / 1000;
78+ tv.tv_usec = (timeout_milliseconds % 1000) * 1000;
79+
80+ ready = select (max_fd + 1, &read_set, &write_set, &err_set,
81+ timeout_milliseconds < 0 ? NULL : &tv);
82+
83++ if (ready < 0 && errno == EBADF)
84++ {
85++ ready = 0;
86++
87++ /* One of the file descriptors we were asked to poll was invalid.
88++ * Can we tell which one? */
89++ for (i = 0; i < n_fds; i++)
90++ {
91++ DBusPollFD *fdp = &fds[i];
92++ int res;
93++
94++ res = fcntl (fdp->fd, F_GETFD, 0);
95++
96++ if (res == -1 && errno == EBADF)
97++ {
98++ fdp->revents = _DBUS_POLLNVAL;
99++ ready++;
100++ }
101++ }
102++
103++ if (ready > 0)
104++ {
105++ /* We can report at least one fd as POLLNVAL. Good enough! */
106++ return ready;
107++ }
108++ else
109++ {
110++ /* One of the fds was invalid, but when we went back and looked at
111++ * them all, none still appeared to be invalid.
112++ * Give up and report the error as select() would. */
113++ errno = EBADF;
114++ return -1;
115++ }
116++ }
117++
118+ if (ready > 0)
119+ {
120+ for (i = 0; i < n_fds; i++)
121+ {
122+ DBusPollFD *fdp = &fds[i];
123+
124+- fdp->revents = 0;
125++ if (fdp->fd < 0)
126++ continue;
127+
128+ if (FD_ISSET (fdp->fd, &read_set))
129+ fdp->revents |= _DBUS_POLLIN;
130+--
131+GitLab
132+ 
@@ -1,7 +1,7 @@
1Name: dbus1Name: dbus
2Epoch: 12Epoch: 1
3Version: 1.12.203Version: 1.12.20
4-Release: 134+Release: 14
5Summary: System Message Bus5Summary: System Message Bus
6License: AFLv3.0 or GPLv2+6License: AFLv3.0 or GPLv2+
7URL: http://www.freedesktop.org/Software/dbus/7URL: http://www.freedesktop.org/Software/dbus/
@@ -34,6 +34,7 @@ Patch6019: backport-0002-CVE-2026-120749.patch
34Patch6020: backport-0003-CVE-2026-120749.patch34Patch6020: backport-0003-CVE-2026-120749.patch
35Patch6021: backport-0004-CVE-2026-120749.patch35Patch6021: backport-0004-CVE-2026-120749.patch
36Patch6022: backport-0005-CVE-2026-120749.patch36Patch6022: backport-0005-CVE-2026-120749.patch
37+Patch6023: backport-CVE-2026-128885.patch
37 38 
38BuildRequires: systemd-devel expat-devel libselinux-devel audit-libs-devel doxygen xmlto cmake39BuildRequires: systemd-devel expat-devel libselinux-devel audit-libs-devel doxygen xmlto cmake
39BuildRequires: autoconf-archive libtool libX11-devel libcap-ng-devel libxslt40BuildRequires: autoconf-archive libtool libX11-devel libcap-ng-devel libxslt
@@ -247,6 +248,9 @@ fi
247%exclude %{_pkgdocdir}/README248%exclude %{_pkgdocdir}/README
248 249 
249%changelog250%changelog
251+* Sat Nov 14 2026 zhangtao <zhangtao@kylinos.cn> - 1:1.12.20-14
252+- fix CVE-2026-128885
253+ 
250* Thu Nov 12 2026 hugel <2712504175@qq.com> - 1:1.12.20-13254* Thu Nov 12 2026 hugel <2712504175@qq.com> - 1:1.12.20-13
251- fix CVE-2026-120749255- fix CVE-2026-120749
252 256