Commit graph

5329 commits

Author SHA1 Message Date
Jan Tojnar
5fd9680e13 bus/dir-watch: Do not crash with > 128 dirs
Without this running, dbus-daemon with long XDG_DATA_DIRS
will crash on out-of-bounds write:

	$ XDG_DATA_DIRS=$(seq  -f "/foo/%g" -s ':' 129) dbus-daemon --session
	*** stack smashing detected ***: terminated

(cherry picked from commit b551b3e973)
Backported-from: dbus!302
(cherry picked from commit 9e8fe0718c)
2022-09-19 10:47:59 +01:00
Simon McVittie
0a516ae5a7 Merge branch '1.12-ci' into 'dbus-1.12'
Fix CI for 1.12.x

See merge request dbus/dbus!342
2022-09-13 15:37:26 +00:00
Simon McVittie
b559b318f1 CI: Use Debian 11 'bullseye' for most builds
dbus 1.12.x was included in both Debian 10 'buster', which is now EOL,
and Debian 11 'bullseye', which continues to be supported. I need this
branch to work on Debian 11 for security and bugfix backports, but I'm
no longer supporting Debian 10.

Leave one build variant, the "legacy" build, on Debian 10 to check that
we can still build there, to be nice to the Debian LTS subproject.

Also continue to use Debian 10 for mingw builds, since dbus#380 has
not been fixed in this branch (which is now the security-fix-only
old-stable branch, so the fix will not be backported).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-13 16:15:50 +01:00
Simon McVittie
99fa277774 CI: Don't pin msys2 packages to a specific version at all
Similar to dbus/dbus!286, but more so: just use the package names,
ignoring their version numbers completely.

pcre2 is not strictly needed at the moment, but it'll be a dependency
for GLib >= 2.73.x (older versions used pcre). For a bit of
future-proofing, download both pcre and pcre2.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 8aa34131dd)
2022-09-13 16:08:36 +01:00
Ralf Habacker
182eafb3a2 tools/ci-install.sh: clean up the previously used installation prefix and the downloaded mingw packages
This is necessary to have a clean initial state when running the script
locally.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
(cherry picked from commit 067733d4b0)
2022-09-13 16:08:34 +01:00
Ralf Habacker
1b01354713 tools/ci-install.sh: Use partially qualified versions with mingw package names
Fixes dbus/dbus#388

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
(cherry picked from commit 85f5f05038)
2022-09-13 16:08:27 +01:00
Ralf Habacker
d2af6ad891 tools/ci-install.sh: on debian|ubuntu reduce the need for mingw package name changes
Instead of having to specify an exact version that needs to be adjusted
with each repository update, it is now possible to specify package names
without version or partially qualified versions, which reduces the
frequency of necessary adjustments.

This is achieved by searching for the package names in a previously
downloaded list of available packages.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
(cherry picked from commit 7e9d3708b1)
2022-09-13 16:08:25 +01:00
Simon McVittie
458095551a Post-release version bump
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 17:39:52 +00:00
Simon McVittie
177ab044bc Prepare v1.12.22
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 15:39:56 +00:00
Simon McVittie
16cf33b513 doc: Uninstall *.svg generated by Doxygen
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 8afc535770)
2022-02-25 15:39:56 +00:00
Simon McVittie
2b71d1eed8 NEWS: Update
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 15:27:20 +00:00
Simon McVittie
b4448e6076 Merge branch '1.12-backports' into 'dbus-1.12'
[1.12.x] Backport various fixes to dbus-1.12

See merge request dbus/dbus!258
2022-02-25 15:22:38 +00:00
Marc-André Lureau
c8e7818723 bus/signal: fix compilation when only -Dembedded-tests
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit a58d46b789)
2022-02-25 14:57:18 +00:00
Simon McVittie
b38a39884c sysdeps-unix: Diagnose failure to open /proc/self/oom_score_adj
Previously, we silently ignored this, but now that we're more careful
about the contexts in which we try to reset the OOM score and whether
we log failures as a warning, we can let the dbus-daemon-launch-helper
show a message if it can't write there.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 226f24144a)
2022-02-25 14:57:18 +00:00
Simon McVittie
c32b5cc4ed spawn-unix: Don't log an error if unable to reset Linux OOM score
We cannot safely log between fork() and exec() because it isn't an
async-signal-safe operation (in particular it might allocate memory).

We also don't want to treat a failure here as a real problem, because
it might legitimately not work: in a system dbus-daemon that has dropped
privileges from root, the pseudo-file representing this process parameter
remains owned by root and cannot be altered by the unprivileged user.

For the main use-case for this operation, the system dbus-daemon, we
have another opportunity to do this in the dbus-daemon-launch-helper
(see the previous commit).

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7ee72a2795)
2022-02-25 14:57:18 +00:00
Simon McVittie
e7a4123d6e dbus-daemon-launch-helper: Reset Linux OOM score adjustment here
Previously, we were relying on the system bus being able to reset
its OOM score adjustment after it forks, but before it execs the
dbus-daemon-launch-helper. However, it can't actually do that (leading
to dbus#378), because the system bus typically starts as root, uses its
root privileges to adjust resource limits, and then drops privileges
to the `@DBUS_USER@`, typically `dbus` or `messagebus`. This leaves the
pseudo-files in /proc for its process parameters owned by root, and the
`@DBUS_USER@` is not allowed to open them for writing.

The dbus-daemon-launch-helper is setuid root, so it can certainly
alter its OOM score adjustment before exec'ing the actual activated
service. We need to do this before dropping privileges, because after
dropping privileges we would be unable to write to this process
parameter.

This is a non-async-signal-safe context, so we can safely log errors
here, unlike the fork-and-exec code paths.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/378
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 2efb462466)
2022-02-25 14:57:18 +00:00
Simon McVittie
4ed9f00a7c spawn-unix: On Linux, don't try to increase OOM-killer protection
The oom_score_adj parameter is a signed integer, with increasingly
positive values being more likely to be killed by the OOM-killer,
and increasingly negative values being less likely.

Previously, we assumed that oom_score_adj would be negative or zero,
and reset it to zero, which does not require privileges because it
meant we're voluntarily giving up our OOM-killer protection.
In particular, bus/dbus.service.in has OOMScoreAdjust=-900, which
we don't want system services to inherit.

However, systemd >= 250 has started putting a positive oom_score_adj
on user processes, to make it more likely that the OOM killer will kill
a user process rather than a system process. Changing from a positive
oom_score_adj to zero is increasing protection from the OOM-killer,
which only a privileged process is allowed to do, resulting in warnings
whenever we carry out traditional (non-systemd) service activation
on the session bus.

To avoid this, do the equivalent of:

    if (oom_score_adj < 0)
        oom_score_adj = 0;

which is always allowed.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/374
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit c42bb64457)
2022-02-25 14:57:18 +00:00
Simon McVittie
7200555694 sysdeps-unix: Factor out _dbus_reset_oom_score_adj
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit f3ffe9a873)
2022-02-25 14:57:18 +00:00
Simon McVittie
0e4b432f71 spawn-unix: Correct indentation
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 715a1a920d)
2022-02-25 14:57:18 +00:00
Simon McVittie
ba6fdab22d tests: Ensure session bus has started before integration test
The session dbus-daemon won't necessarily be run immediately on login
if we are using systemd socket activation for it, and the transient
services directory $XDG_RUNTIME_DIR/dbus-1/services isn't created until
it's actually run. Ping the dbus-daemon to make sure it's available.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug-Debian: https://bugs.debian.org/1005889
(cherry picked from commit 47a4bdfaf8)
2022-02-25 14:57:18 +00:00
Simon McVittie
e5922ee271 Merge branch '1.12-ci' into 'dbus-1.12'
[1.12.x] CI: Partially catch up with 1.13.x

See merge request dbus/dbus!259
2022-02-25 14:56:51 +00:00
Simon McVittie
5c46e97068 CI: Remove EOL versions of Debian and Ubuntu
Debian 9 'stretch' is EOL, and Ubuntu 16.04 is EOL unless you enter into
a special subscription with Canonical. This puts them outside our
informal security-support policy, and realistically, anyone sufficiently
change-averse to be following these distributions is not going to be
backporting a current version of dbus.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 69c610f6f0)
2022-02-25 14:17:01 +00:00
Ralf Habacker
babbb437c2 .gitlab-ci.yml: Use x86_64 build chain to cross build 64bit executables
This error was discovered when working with the merge request
dbus/dbus!158.

(cherry picked from commit 74717a9c0c)
2022-02-25 14:17:01 +00:00
Ralf Habacker
25aeef60f8 Remove build: prefix from jobs to make labels more visible in pipeline page
The length if the displayed jobs is limited on the gitlab CI pipeline page
and is occupied partly be the prefix.

Cherry-picked from dbus/dbus/!192

(cherry picked from commit d2bab84329)
2022-02-25 14:17:01 +00:00
Simon McVittie
c6e9f3e1d2 CI: Don't build on Debian 8 'jessie'
Debian 8 'jessie' has reached EOL for mainstream security support,
which puts it outside our usual distribution/OS support policy.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 3ce28815e9)
2022-02-25 14:17:01 +00:00
Simon McVittie
32b27f273a CI: Build on Debian 10 'buster' by default
Previously, we built on Debian 9 'stretch' by default, and on
Debian 10 'buster' only on request. Let's reverse that so that we get
more modern toolchains, before Debian 9 'stretch' reaches EOL.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 73cfcb95c6)
2022-02-25 14:17:01 +00:00
Simon McVittie
fc2353f210 CI: Use Python 3
The dbus-1.12 branch needed Python, which the master branch no longer
does, but we can at least use a modern Python.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 14:17:01 +00:00
Simon McVittie
bad56dc99a CI: Use https to download MSYS packages
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 14:17:01 +00:00
Simon McVittie
1784fa3da1 CI: Install ci-certificates
We need this to be able to download MSYS packages now.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 14:17:01 +00:00
Simon McVittie
665e56653c CI: Fix unpack of documentation tarball
In dbus 1.12.x, this was a tar.gz archive, not a tar.xz archive.

Fixes: 8d34987e "CI: Exercise maintainer-only documentation build"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 14:17:01 +00:00
Marc-André Lureau
029a0adf4b ci: bump msys2 deps, fix broken links
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit c5385dfd60)
2022-02-25 14:17:01 +00:00
Ralf Habacker
1701d9f1a6 tools/ci-install.sh: Use package=() style for local package list to avoid '\' notation
(cherry picked from commit 6412ccdf67)
2022-02-25 14:17:01 +00:00
Ralf Habacker
b49c0ad652 On CI use common install prefix named 'dep_prefix' for installing local packages
With this commit a new variable 'ci_local_packages' has been introduced
to have a choice for using development packages from a local installation
or from the distribution.

(cherry picked from commit 9c5734fe90)
2022-02-25 14:17:01 +00:00
Ralf Habacker
83d203d460 tools/ci-build.sh: Clean up directories from possible previous builds
Otherwise, ci-build.sh cannot be executed on a local system if there
are previous runs.

(cherry picked from commit e82d5fe486)
2022-02-25 13:26:40 +00:00
Ralf Habacker
e9b0e6069d tools/ci-install.sh: merge multiple calls to apt-get
This required a reorganization of the steps that had been carried out.
The new order is:
   1. install packages with apt-get
   2. create user for build if required
   3. fetch and unpack tar balls
   4. create messagebus user

(cherry picked from commit 478484f13c)
[backport for 1.12.x: This branch still needed python-dbus, python-gi]
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 13:26:36 +00:00
Ralf Habacker
331e05dc5d Move installing packages into tools/ci-install.sh
In tools/ci-build.sh the cross compile setup has to be moved further up
to match the correct subdirectory.

(cherry picked from commit 1e3d82d85e)
2022-02-25 13:16:55 +00:00
Simon McVittie
99523f3535 CI: Do the CMake native debug build from an Autotools make dist
We officially release dbus in the form of Autotools `make dist` tarballs,
but people who have downloaded those tarballs should be able to choose
the CMake build system. Our CI should assert that they can.

(The Autotools debug build already does a `make distcheck`, which
asserts that tarball releases can be used for an Autotools build.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: dbus#255
(cherry picked from commit 1063bba06b)
[backport for 1.12.x: in 1.12.x, `make dist` produces .tar.gz]
2022-02-25 13:16:52 +00:00
Simon McVittie
47018f5c3c CI: Install yelp-tools, for yelp-build, in recent distros
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 78efbb6c0d)
2022-02-25 13:04:20 +00:00
Simon McVittie
074934f18d CI: Make adduser properly non-interactive
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 52fcc82379)
2022-02-25 13:04:20 +00:00
Simon McVittie
52c881487d CI: Don't install weak dependencies (Recommends)
In particular this avoids installing the TeX toolchain.

However, this also means we don't install dbus, which broke some tests
in minimal containers where dbus wasn't already installed, because the
messagebus user wouldn't have been created. Make sure that user exists,
using the same adduser call as the Debian dbus package.

CMake really wants to find a C++ compiler (even though we only use C++
when compiling for Windows), so explicitly install the default
version of the GNU C++ compiler, g++.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit cb6abc6391)
2022-02-25 13:04:20 +00:00
Simon McVittie
787b9e9633 ci: Teach ci-install.sh to install wine on Debian 9 'stretch'
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=108177
Acked-by: Philip Withnall <withnall@endlessm.com>
(cherry picked from commit 408b222a9f)
2022-02-25 13:04:20 +00:00
Simon McVittie
d1799f782b ci-build: Update required MSYS packages
The older versions we were previously building against are no longer
available on mirrors.

Based on changes proposed in !189 by Arnout Engelen, and the package
list gathered by Ralf Habacker in #318.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/318
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 053238254e)
2022-02-25 13:04:20 +00:00
Simon McVittie
38f77d4ebe CI: Add ci_variant parameter
Originally part of commit 23e1f044 "Install qhelpgenerator for native
production build on buster". Later CI fixes rely on having this
available.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-25 13:04:16 +00:00
Simon McVittie
9c1c573041 Belatedly bump version number to 1.12.21 for development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-12-17 13:01:10 +00:00
Simon McVittie
f6e894efd5 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-12-17 13:00:49 +00:00
Simon McVittie
b44e0cc9f4 internals: Use Standard C offsetof macro if available
clang 13 fails to compile our current implementation with:

.../dbus/dbus-message.c:2070:3: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
  _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (DBusMessageRealIter) <=
  ^
.../dbus/dbus-internals.h:460:25: note: expanded from macro '_DBUS_STATIC_ASSERT'
  typedef struct { char _assertion[(expr) ? 1 : -1]; } \

This appears to be because the "traditional" definition of
offsetof(), which we're hard-coding here, does not qualify as a constant
expression under C rules due to its use of pointer casts.

Modern compilers like gcc and clang have a built-in implementation
of offsetof that *is* a constant expression.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit a24cf746e2)
2021-12-17 12:57:42 +00:00
Jean-Louis Fuchs
d13349f25c disable fork-malloc-exec for non-glibc-systems
Calling malloc() after fork is undefined behaviour if the process is
multi-threaded. locks held by a thread on fork() will never be released.
malloc() is usally protected by a lock and can therefore deadlock. glibc
is known not to deadlock in this case.

This commit does not rule out other problems on glibc-systems, but fixes an
issue on musl-libc-systems. Only restricting to async-signal safe functions
between fork() and exec() prevents undefined behaviour for sure. See
signal-safety(7).

(cherry picked from commit 3fab06d68f)
2021-12-17 12:55:33 +00:00
Simon McVittie
ac6e6cb68a doc: Don't include TODO list in API documentation
This is sorted non-deterministically, which is undesired for reproducible
builds, and is not really part of the API in any case.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit ce8d7759a2)
2021-12-17 12:54:40 +00:00
Arnout Engelen
91e0c5f0cc docs: generate reproducible ids
With this parameter, docbook will generate the same id's when generating the
same docs. This is helpful to get bit-by-bit 'reproducible' output, which
makes auditing the package easier.

(cherry picked from commit 43e0188dbf)
2021-12-17 12:54:28 +00:00
William Earley
73aa7f9739 dbus-launch: Replace slashes in DISPLAY if present
dbus-daemon fails to autolaunch with X11 on macOS 10.8+ because XQuartz
(the X11 package for macOS) provides a value for `$DISPLAY` that is
not expected by dbus, in that it contains `/` characters. This is
addressed by replacing the invalid path character `/` with `_`.

Resolves: #8
Resolves: #311
(cherry picked from commit 3545d0f4de)
2021-12-17 12:53:26 +00:00