Open
fix CVE-2026-128885 #118
fix CVE-2026-128885 #118
Open
zhangtao99Add on 5 days ago
Total: 2 files changed+138-1
@@ -0,0 +1,133 @@
1+Origin: https://gitlab.freedesktop.org/dbus/dbus/-/commit/dab3fee27affab37c97a8323a36385ed818f3562
2+From dab3fee27affab37c97a8323a36385ed818f3562 Mon Sep 17 00:00:00 2001
3+From: Simon McVittie <smcv@collabora.com>
4+Date: Tue, 3 Nov 2026 16:12:45 +0000
5+Subject: [PATCH] sysdeps-unix: Make _dbus_poll() emulate poll() more
6+ accurately
7+ 
8+An LLM-based code audit by AISLE in partnership with Red Hat reported
9+that on Unix platforms where _dbus_poll() calls select(), if an attacker
10+can induce dbus-daemon to allocate 1024 or more fds, then they can cause
11+a stack buffer overflow that will most likely crash the dbus-daemon,
12+which in principle is a denial-of-service vulnerability.
13+ 
14+In practice we believe this will only happen on macOS and Interix (for
15+the reasons described in dbus-sysdeps.h by commit 0414ea65), plus our
16+"legacy" CI build which intentionally pretends that poll() doesn't work
17+in order to get test coverage on this code path.
18+ 
19+According to POSIX, negative fds result in no events being returned.
20+I don't know whether dbus actually relies on this behaviour (I suspect
21+that it does not) but let's emulate it faithfully.
22+ 
23+Similarly, invalid fds are represented by POLLNVAL. Let's use that
24+representation for fds that are outside the range that can be polled
25+successfully by a select()-based emulation. We already know that users
26+of _dbus_poll() have to be able to cope with this, for the case where
27+_dbus_poll() is implemented as poll().
28+ 
29+Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/work_items/584
30+Bug-RedHat: https://redhat.atlassian.net/browse/RHEL-239610
31+Signed-off-by: Simon McVittie <smcv@collabora.com>
32+(cherry picked from commit 282b3fa1fae234c978ef382f88d75eb5ac00b076)
33+---
34+ dbus/dbus-sysdeps-unix.c | 57 ++++++++++++++++++++++++++++++++++++++--
35+ 1 file changed, 55 insertions(+), 2 deletions(-)
36+ 
37+diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
38+index 72608ef4c..d8c1c192c 100644
39+--- a/dbus/dbus-sysdeps-unix.c
40++++ b/dbus/dbus-sysdeps-unix.c
41+@@ -3389,7 +3389,7 @@ _dbus_poll (DBusPollFD *fds,
42+ int max_fd = 0;
43+ int i;
44+ struct timeval tv;
45+- int ready;
46++ int ready = 0;
47+
48+ FD_ZERO (&read_set);
49+ FD_ZERO (&write_set);
50+@@ -3399,6 +3399,20 @@ _dbus_poll (DBusPollFD *fds,
51+ {
52+ DBusPollFD *fdp = &fds[i];
53+
54++ fdp->revents = 0;
55++
56++ /* poll(2) documents that fd < 0 is ignored
57++ * (no events will be reported) */
58++ if (fdp->fd < 0)
59++ continue;
60++
61++ if (fdp->fd >= FD_SETSIZE)
62++ {
63++ fdp->revents = _DBUS_POLLNVAL;
64++ ready++;
65++ continue;
66++ }
67++
68+ if (fdp->events & _DBUS_POLLIN)
69+ FD_SET (fdp->fd, &read_set);
70+
71+@@ -3410,19 +3424,58 @@ _dbus_poll (DBusPollFD *fds,
72+ max_fd = MAX (max_fd, fdp->fd);
73+ }
74+
75++ if (ready > 0)
76++ return ready;
77++
78+ tv.tv_sec = timeout_milliseconds / 1000;
79+ tv.tv_usec = (timeout_milliseconds % 1000) * 1000;
80+
81+ ready = select (max_fd + 1, &read_set, &write_set, &err_set,
82+ timeout_milliseconds < 0 ? NULL : &tv);
83+
84++ if (ready < 0 && errno == EBADF)
85++ {
86++ ready = 0;
87++
88++ /* One of the file descriptors we were asked to poll was invalid.
89++ * Can we tell which one? */
90++ for (i = 0; i < n_fds; i++)
91++ {
92++ DBusPollFD *fdp = &fds[i];
93++ int res;
94++
95++ res = fcntl (fdp->fd, F_GETFD, 0);
96++
97++ if (res == -1 && errno == EBADF)
98++ {
99++ fdp->revents = _DBUS_POLLNVAL;
100++ ready++;
101++ }
102++ }
103++
104++ if (ready > 0)
105++ {
106++ /* We can report at least one fd as POLLNVAL. Good enough! */
107++ return ready;
108++ }
109++ else
110++ {
111++ /* One of the fds was invalid, but when we went back and looked at
112++ * them all, none still appeared to be invalid.
113++ * Give up and report the error as select() would. */
114++ errno = EBADF;
115++ return -1;
116++ }
117++ }
118++
119+ if (ready > 0)
120+ {
121+ for (i = 0; i < n_fds; i++)
122+ {
123+ DBusPollFD *fdp = &fds[i];
124+
125+- fdp->revents = 0;
126++ if (fdp->fd < 0)
127++ continue;
128+
129+ if (FD_ISSET (fdp->fd, &read_set))
130+ fdp->revents |= _DBUS_POLLIN;
131+--
132+GitLab
133+ 
@@ -1,7 +1,7 @@
1Name: dbus1Name: dbus
2Epoch: 12Epoch: 1
3Version: 1.16.23Version: 1.16.2
4-Release: 24+Release: 3
5Summary: System Message Bus5Summary: System Message Bus
6License: (AFL-2.1 OR GPL-2.0-or-later) AND GPL-2.0-or-later6License: (AFL-2.1 OR GPL-2.0-or-later) AND GPL-2.0-or-later
7URL: https://www.freedesktop.org/Software/dbus/7URL: https://www.freedesktop.org/Software/dbus/
@@ -18,6 +18,7 @@ Patch6003: backport-bus-Give-bus-generated-messages-a-serial-number-before-capt
18Patch6004: backport-bus-Assert-messages-passed-to-bus_transaction_capture-are-ready.patch18Patch6004: backport-bus-Assert-messages-passed-to-bus_transaction_capture-are-ready.patch
19Patch6005: backport-bus-Check-some-more-preconditions.patch19Patch6005: backport-bus-Check-some-more-preconditions.patch
20Patch6006: backport-monitor-test-Reproduce-dbus-dbus-576.patch20Patch6006: backport-monitor-test-Reproduce-dbus-dbus-576.patch
21+Patch6007: backport-CVE-2026-128885.patch
21 22 
22BuildRequires: gcc make23BuildRequires: gcc make
23BuildRequires: meson >= 0.5624BuildRequires: meson >= 0.56
@@ -238,6 +239,9 @@ fi
238%{_docdir}/%{name}/*.txt239%{_docdir}/%{name}/*.txt
239 240 
240%changelog241%changelog
242+* Sat Nov 14 2026 zhangtao <zhangtao@kylinos.cn> - 1:1.16.2-3
243+- fix 2026
244+ 
241* Mon Nov 09 2026 infra_team <zhaiwenjie1@huawei.com> - 1:1.16.2-2245* Mon Nov 09 2026 infra_team <zhaiwenjie1@huawei.com> - 1:1.16.2-2
242- fix CVE-2026-120749: backport denial-of-service fix for dbus#576246- fix CVE-2026-120749: backport denial-of-service fix for dbus#576
243- assign serial numbers to messages created by the driver so that247- assign serial numbers to messages created by the driver so that