]> git.ipfire.org Git - thirdparty/dbus.git/log
thirdparty/dbus.git
2 years agoMerge branch 'jepio/fix-log-callback-segfault' into 'master'
Simon McVittie [Tue, 10 Jan 2023 11:59:06 +0000 (11:59 +0000)] 
Merge branch 'jepio/fix-log-callback-segfault' into 'master'

bus/selinux: Move vsnprintf call to avoid va_list reuse

See merge request dbus/dbus!386

2 years agobus/selinux: Move vsnprintf call to avoid va_list reuse
Jeremi Piotrowski [Mon, 9 Jan 2023 16:11:32 +0000 (17:11 +0100)] 
bus/selinux: Move vsnprintf call to avoid va_list reuse

In log_callback() the same va_list is reused for a call to vsnprintf and
vsyslog. A va_list can't be reused in this manner, such use is undefined
behavior that changes depending on glibc version.

In current glibc versions a segfault can be observed from the callsite at
bus/selinux.c:412. When trying to log a non-auditable event, the segfault
happens in strlen inside vsyslog.

Moving the call to vsnprintf closer to audit_log_user_avc_message (which is
followed by a 'goto out') avoids the reuse and segfault.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2 years agoMerge branch 'meson-fvisibility-hidden' into 'master'
Simon McVittie [Mon, 9 Jan 2023 15:01:52 +0000 (15:01 +0000)] 
Merge branch 'meson-fvisibility-hidden' into 'master'

meson: Use -fvisibility=hidden on Unix if supported

See merge request dbus/dbus!383

2 years agomeson: Use -fvisibility=hidden on Unix if supported
Simon McVittie [Fri, 6 Jan 2023 13:49:17 +0000 (13:49 +0000)] 
meson: Use -fvisibility=hidden on Unix if supported

This avoids accidentally exporting all of our private symbols as part
of the LIBDBUS_PRIVATE_x.y.z verdef, including ones that don't need to
be visible outside the shared library even when testing internals
(_dbus_watch_set_handler is a good example).

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/437
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'fix-data-race' into 'master'
Ralf Habacker [Sat, 7 Jan 2023 09:17:43 +0000 (09:17 +0000)] 
Merge branch 'fix-data-race' into 'master'

Fix data race with members of struct DBusCounter

Closes #426

See merge request dbus/dbus!379

2 years agoFix data race in multithreaded application
Ralf Habacker [Tue, 3 Jan 2023 13:29:14 +0000 (14:29 +0100)] 
Fix data race in multithreaded application

This commit fixes a data race condition discovered by the
gcc thread sanitizer by also locking the associated mutex
when reading the corresponding counter.

Fixes #426

2 years agoAdd multithreaded unit test for DBusCounter to available build systems
Ralf Habacker [Tue, 3 Jan 2023 13:21:51 +0000 (14:21 +0100)] 
Add multithreaded unit test for DBusCounter to available build systems

The mentioned test is build on unix like platforms when embedded tests
are enabled.

2 years agoMerge branch 'meson-declare-dependency' into 'master'
Simon McVittie [Wed, 4 Jan 2023 14:26:56 +0000 (14:26 +0000)] 
Merge branch 'meson-declare-dependency' into 'master'

meson: Declare dependency for use as a subproject

See merge request dbus/dbus!368

2 years agomeson: Introduce message_bus and tools command line option
Daniel Wagner [Thu, 24 Nov 2022 08:17:45 +0000 (09:17 +0100)] 
meson: Introduce message_bus and tools command line option

To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.

The strong recommendation is only to build libdbus as static library:

  libdbus_dep = dependency(
    'dbus-1',
    required: get_option('libdbus'),
    fallback: ['dbus', 'libdbus_dep'],
    default_options: [
      'default_library=static',
      'embedded_tests=false',
      'message_bus=false',
      'modular_tests=disabled',
      'tools=false',
    ],
  )

This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agomeson: Declare dependency
Daniel Wagner [Tue, 22 Nov 2022 14:43:47 +0000 (15:43 +0100)] 
meson: Declare dependency

Allow other Meson project to consume libdbus as subproject. For this
we need to instantiate a dependency object.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge branch 'spdx-afl-2.1-or-gpl-2.0' into 'master'
Ralf Habacker [Wed, 4 Jan 2023 07:54:16 +0000 (07:54 +0000)] 
Merge branch 'spdx-afl-2.1-or-gpl-2.0' into 'master'

Add SPDX license marker for the AFL-2.1 OR GPL-2.0-or-later license

See merge request dbus/dbus!375

2 years agodbus/dbus-macros-internal.h: Add blank line after the copyright state
Ralf Habacker [Wed, 4 Jan 2023 07:32:55 +0000 (08:32 +0100)] 
dbus/dbus-macros-internal.h: Add blank line after the copyright state

Thus it is identical with the other places.

2 years agoAdd SPDX license marker for the AFL-2.1 OR GPL-2.0-or-later license
Ralf Habacker [Mon, 2 Jan 2023 14:31:43 +0000 (15:31 +0100)] 
Add SPDX license marker for the AFL-2.1 OR GPL-2.0-or-later license

The full license texts are not added because they were already
added in a previous commit.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
see #394

2 years agoMerge branch 'master' into 'master'
Ralf Habacker [Wed, 4 Jan 2023 07:40:59 +0000 (07:40 +0000)] 
Merge branch 'master' into 'master'

_dbus_loop_iterate: `timeout` can be defined as int

See merge request dbus/dbus!381

2 years ago_dbus_loop_iterate: `timeout` can be defined as int
Xin Shi [Wed, 4 Jan 2023 02:19:56 +0000 (10:19 +0800)] 
_dbus_loop_iterate: `timeout` can be defined as int

all places where `timeout` is used can be represented as int.
This MR is a response to issue #430.

Signed-off-by: Xin Shi <shixin21@huawei.com>
2 years agoMerge branch 'spdx-FSFULLR' into 'master'
Simon McVittie [Tue, 3 Jan 2023 19:24:08 +0000 (19:24 +0000)] 
Merge branch 'spdx-FSFULLR' into 'master'

Add SPDX license marker for the FSFULLR license

See merge request dbus/dbus!376

2 years agoAdd SPDX license marker for the FSFULLR license
Ralf Habacker [Mon, 2 Jan 2023 14:55:31 +0000 (15:55 +0100)] 
Add SPDX license marker for the FSFULLR license

The associated full license text was retrieved from https://spdx.org.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2 years agoMerge branch 'fix-425' into 'master'
Simon McVittie [Tue, 3 Jan 2023 19:02:12 +0000 (19:02 +0000)] 
Merge branch 'fix-425' into 'master'

Permit access to /tmp dbus socket

See merge request dbus/dbus!380

2 years agoPermit access to /tmp dbus socket
Dave Jones [Tue, 3 Jan 2023 18:42:51 +0000 (18:42 +0000)] 
Permit access to /tmp dbus socket

After 6e48c317 the test-apparmor-activation test fails as it can no
longer access the dbus socket in /tmp. This commit updates the apparmor
profile used within the test

2 years agoMerge branch 'master' into 'master'
Ralf Habacker [Tue, 3 Jan 2023 10:47:04 +0000 (10:47 +0000)] 
Merge branch 'master' into 'master'

socket_handle_watch: break when `found` is TRUE in server

See merge request dbus/dbus!374

2 years agosocket_handle_watch: break when `found` is TRUE in server
Aiknow [Thu, 15 Dec 2022 02:38:12 +0000 (10:38 +0800)] 
socket_handle_watch: break when `found` is TRUE in server

skip useless loop when `found` is TRUE.
This MR is a response to issue #431.

Signed-off-by: Aiknow <shixin21@huawei.com>
3 years agoMerge branch 'use-gitlab-uri' into 'master'
Simon McVittie [Wed, 30 Nov 2022 19:17:33 +0000 (19:17 +0000)] 
Merge branch 'use-gitlab-uri' into 'master'

cleanup: Use gitlab URI for bug reporting

See merge request dbus/dbus!372

3 years agocleanup: Use gitlab URI for bug reporting
Marco Trevisan (Treviño) [Tue, 1 Nov 2022 14:54:13 +0000 (15:54 +0100)] 
cleanup: Use gitlab URI for bug reporting

Bugzilla is dead for long time now.

3 years agoMerge branch 'pointer-assumptions' into 'master'
Simon McVittie [Tue, 29 Nov 2022 22:26:39 +0000 (22:26 +0000)] 
Merge branch 'pointer-assumptions' into 'master'

Statically assert some things we assume about pointers

See merge request dbus/dbus!345

3 years agointernals: Statically assert some things we assume about pointers
Simon McVittie [Tue, 29 Nov 2022 20:47:21 +0000 (20:47 +0000)] 
internals: Statically assert some things we assume about pointers

Like many relatively-low-level codebases, dbus has historically assumed
that data pointers are interchangeable with function pointers (which is
implied by POSIX and also true on Windows, but not guaranteed by ISO C).

Before dbus!335 was merged, we also assumed that size_t is the same
size as a pointer (which is frequently assumed, but not guaranteed by
ISO C, and notably not true on CHERI). dbus!335 is believed to have
removed all uses of that assumption.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus-marshal-basic: Use _DBUS_ALIGNOF to compare alignments
Simon McVittie [Wed, 14 Sep 2022 12:32:47 +0000 (13:32 +0100)] 
dbus-marshal-basic: Use _DBUS_ALIGNOF to compare alignments

This means we get the alignment comparisons even on non-gcc compilers.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'cmake-licenseref' into 'master'
Simon McVittie [Tue, 29 Nov 2022 22:10:46 +0000 (22:10 +0000)] 
Merge branch 'cmake-licenseref' into 'master'

Fix SPDX license reference in FindGLIB2

See merge request dbus/dbus!371

3 years agoFix SPDX license reference in FindGLIB2
Simon McVittie [Tue, 29 Nov 2022 20:41:44 +0000 (20:41 +0000)] 
Fix SPDX license reference in FindGLIB2

The `.txt` here was unnecessary.

Fixes: d6abc1da "cmake: Add BSD-style licenses"
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'lgpl' into 'master'
Simon McVittie [Tue, 29 Nov 2022 20:44:35 +0000 (20:44 +0000)] 
Merge branch 'lgpl' into 'master'

Add missing license text for LGPL-2.1-or-later

See merge request dbus/dbus!369

3 years agoAdd missing license text for LGPL-2.1-or-later
Simon McVittie [Tue, 29 Nov 2022 19:32:26 +0000 (19:32 +0000)] 
Add missing license text for LGPL-2.1-or-later

Fixes: 8c1d0f13 "dbus/dbus-backtrace-win.c: New file with backtrace generator for Windows"
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'gpl' into 'master'
Simon McVittie [Tue, 29 Nov 2022 20:43:44 +0000 (20:43 +0000)] 
Merge branch 'gpl' into 'master'

Fix some stray filename references for GPL-2.0-or-later

See merge request dbus/dbus!370

3 years agoFix some stray filename references for GPL-2.0-or-later
Simon McVittie [Tue, 29 Nov 2022 19:34:32 +0000 (19:34 +0000)] 
Fix some stray filename references for GPL-2.0-or-later

The SPDX name for this license includes the `.0`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'goto-considered-unnecessary' into 'master'
Ralf Habacker [Tue, 29 Nov 2022 19:02:38 +0000 (19:02 +0000)] 
Merge branch 'goto-considered-unnecessary' into 'master'

Use 'continue' keyword in preference to 'goto' where possible

See merge request dbus/dbus!356

3 years agoUse 'continue' keyword in preference to 'goto' where possible
Simon McVittie [Fri, 9 Sep 2022 15:21:43 +0000 (16:21 +0100)] 
Use 'continue' keyword in preference to 'goto' where possible

In some more complicated loops, we do need to use 'goto' to exit from
an inner loop, or to jump to cleanup or an increment of an iterator
immediately before the next loop iteration. However, in these simple
cases, jumping to a label immediately before the 'while' keyword is
unnecessary: we can use an equivalent 'continue' statement for flow
control.

This makes it easier for maintainers to notice the loops where we are
doing something more complicated, which still use 'goto', and know
that they need to pay more attention in those cases.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'spdx' into 'master'
Ralf Habacker [Tue, 29 Nov 2022 17:53:36 +0000 (17:53 +0000)] 
Merge branch 'spdx' into 'master'

Add SPDX licensing information for the uncommon licenses (not AFL-2.1|GPL-2.0+ and not MIT)

See merge request dbus/dbus!311

3 years agotools/cmake-format: Relicense to BSD-3-Clause
Ralf Habacker [Tue, 31 May 2022 08:45:44 +0000 (10:45 +0200)] 
tools/cmake-format: Relicense to BSD-3-Clause

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agocmake: Add BSD-style licenses
Simon McVittie [Wed, 18 May 2022 13:09:59 +0000 (14:09 +0100)] 
cmake: Add BSD-style licenses

I've erred on the side of caution and treated the COPYING-CMAKE-SCRIPTS
license (a BSD-3-Clause variation) as its own distinct license.

Co-authored-by: Ralf Habacker <ralf.habacker@freenet.de>
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus/dbus-backtrace-win.c: New file with backtrace generator for Windows
Ralf Habacker [Wed, 1 Jun 2022 08:02:15 +0000 (10:02 +0200)] 
dbus/dbus-backtrace-win.c: New file with backtrace generator for Windows

This file was added to simplify the license documentation, because the
code moved from dbus-sysdeps-win.c is subject to a different license.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: keep license grant; add to Meson build system]
Co-authored-by: Simon McVittie <smcv@collabora.com>
3 years agotools: Mark GPL-only files with SPDX license identifier
Simon McVittie [Wed, 18 May 2022 13:55:48 +0000 (14:55 +0100)] 
tools: Mark GPL-only files with SPDX license identifier

These files are licensed under the GPL only, without the AFL dual-license
of most of the dbus codebase.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Co-authored-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agodbus-arch-deps: Mark as AFL-2.0 OR GPL-2.0-or-later
Simon McVittie [Wed, 18 May 2022 13:35:27 +0000 (14:35 +0100)] 
dbus-arch-deps: Mark as AFL-2.0 OR GPL-2.0-or-later

This was probably meant to be relicensed from AFL-2.0 to AFL-2.1 at the
same time as the rest of the codebase, but it wasn't. For now, just
convert its documented license status into machine-readable form.

The history of this file seems to be completely Red Hat and Collabora,
so we should be able to relicense it to (AFL-2.1 OR GPL-2.0-or-later)
or even to MIT, but let's start by making the stated license more
obvious.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus-hash: Add (AFL-2.1 OR GPL-2.0-or-later) AND TCL SPDX license identifier
Simon McVittie [Wed, 18 May 2022 13:29:11 +0000 (14:29 +0100)] 
dbus-hash: Add (AFL-2.1 OR GPL-2.0-or-later) AND TCL SPDX license identifier

The TCL-derived code is under its own license, so the overall license
of the file is (AFL-2.1 OR GPL-2.0-or-later) AND TCL.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus/dbus-sha.c: add LicenseRef-pycrypto-orig SPDX license marker
Ralf Habacker [Tue, 3 May 2022 08:12:36 +0000 (10:12 +0200)] 
dbus/dbus-sha.c: add LicenseRef-pycrypto-orig SPDX license marker

This permissive license does not appear to be a match for anything
on the SPDX license list, so we need to use the LicenseRef- prefix
for a custom license.

Co-authored-by: Simon McVittie <smcv@collabora.com>
3 years agodbus/versioninfo.rc.in: add LicenseRef-GAP SPDX license marker
Ralf Habacker [Tue, 3 May 2022 08:03:04 +0000 (10:03 +0200)] 
dbus/versioninfo.rc.in: add LicenseRef-GAP SPDX license marker

This permissive license does not appear to be a match for anything
on the SPDX license list, so we need to use the LicenseRef- prefix
for a custom license.

It's referred to as GAP (presumably short for "GNU all-permissive") in
https://sources.debian.org/src/libassuan/2.5.5-1/debian/copyright/
so use the same abbreviation here.

Co-authored-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'clang-ci' into 'master'
Simon McVittie [Fri, 14 Oct 2022 14:40:46 +0000 (14:40 +0000)] 
Merge branch 'clang-ci' into 'master'

ci: build dbus with clang as well

See merge request dbus/dbus!358

3 years agoci: get UBSan to fail and print full backtraces
Evgeny Vereshchagin [Mon, 10 Oct 2022 22:22:06 +0000 (22:22 +0000)] 
ci: get UBSan to fail and print full backtraces

Unlike ASan, by default UBSan prints one-line warnings and keeps going
and it makes it impossible for the CI to catch issues automatically when
it runs the unit tests. With this patch applied the CI should be able to
prevent issues like
https://gitlab.freedesktop.org/smcv/dbus-issue413/-/merge_requests/1#note_1549306
from making it into the repository going forward.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
3 years agoci: build dbus with clang as well
Evgeny Vereshchagin [Mon, 10 Oct 2022 06:17:38 +0000 (06:17 +0000)] 
ci: build dbus with clang as well

It should make it possible to catch issues like
like https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/357

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
3 years agoMerge branch 'mit-license-some-tests' into 'master'
Simon McVittie [Wed, 12 Oct 2022 12:08:46 +0000 (12:08 +0000)] 
Merge branch 'mit-license-some-tests' into 'master'

Add copyright holders and MIT license to some tests that did not specify

See merge request dbus/dbus!359

3 years agotest-exit: Add a permissive license
Simon McVittie [Mon, 6 Jun 2022 14:19:57 +0000 (15:19 +0100)] 
test-exit: Add a permissive license

Red Hat have previously given permission for relicensing, and all
subsequent contributions to this file were trivial.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest-threads-init: Add a permissive license
Simon McVittie [Mon, 6 Jun 2022 14:18:36 +0000 (15:18 +0100)] 
test-threads-init: Add a permissive license

With permission from Philip Withnall on behalf of Endless, me on behalf
of Collabora, and relying on previous permission from Red Hat
representatives.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agomanual-tcp: Add a permissive license
Simon McVittie [Mon, 6 Jun 2022 14:11:44 +0000 (15:11 +0100)] 
manual-tcp: Add a permissive license

With permission from Ralf Habacker via dbus!304 and the mailing list.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agomanual-paths: Apply a permissive license
Simon McVittie [Mon, 6 Jun 2022 14:11:03 +0000 (15:11 +0100)] 
manual-paths: Apply a permissive license

This was contributed by Ralf Habacker and later edited by me, with a
trivial change from Thomas Zimmermann which I don't think affects its
copyright.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agomanual-dir-iter: Apply a permissive license
Simon McVittie [Mon, 6 Jun 2022 14:09:00 +0000 (15:09 +0100)] 
manual-dir-iter: Apply a permissive license

This was contributed by Ralf Habacker, with a trivial change from
Philip Withnall which I don't think affects its copyright.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest-shutdown: Apply a permissive license
Simon McVittie [Mon, 6 Jun 2022 14:04:57 +0000 (15:04 +0100)] 
test-shutdown: Apply a permissive license

All significant contributions to this file were from companies or
individuals that gave permission for relicensing to MIT (I have assumed
that trivial changes from Marcus Brinkmann and Kjartan Maraas were too
small to affect copyright status).

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest-ids: Apply a permissive license
Simon McVittie [Mon, 6 Jun 2022 13:55:42 +0000 (14:55 +0100)] 
test-ids: Apply a permissive license

All significant contributions to this file were from companies that gave
permission for relicensing to MIT (I have assumed that trivial changes
from Marcus Brinkmann and Ralf Habacker were too small to affect
copyright status).

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest-autolaunch: Add a permissive license
Simon McVittie [Mon, 6 Jun 2022 13:52:11 +0000 (14:52 +0100)] 
test-autolaunch: Add a permissive license

The license for this file was never stated, but all contributions to it
have been from Red Hat or Collabora, and representatives of both
companies gave permission for MIT relicensing in 2007.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agolaunch-helper-for-tests: Add a permissive license
Simon McVittie [Mon, 6 Jun 2022 13:48:49 +0000 (14:48 +0100)] 
launch-helper-for-tests: Add a permissive license

I wrote this, and it hasn't changed since.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'test-autolaunch-win-fixes' into 'master'
Simon McVittie [Wed, 12 Oct 2022 11:08:53 +0000 (11:08 +0000)] 
Merge branch 'test-autolaunch-win-fixes' into 'master'

test-autolaunch-win.c: Prevent assertion in dbus_message_unref()

Closes #422

See merge request dbus/dbus!366

3 years agotest-autolaunch-win.c: Prevent assertion in dbus_message_unref()
Ralf Habacker [Wed, 12 Oct 2022 07:34:37 +0000 (09:34 +0200)] 
test-autolaunch-win.c: Prevent assertion in dbus_message_unref()

dbus_message_unref() is in principle able to handle a NULL parameter, but
causes the program to abort when `fatal_warnings_on_check_failed` is set.

Therefore the call with a NULL parameter is avoided from now on.

Fixes #422

3 years agoMerge branch 'no-as-ac-expand' into 'master'
Ralf Habacker [Wed, 12 Oct 2022 06:41:02 +0000 (06:41 +0000)] 
Merge branch 'no-as-ac-expand' into 'master'

Autotools: use AX_RECURSIVE_EVAL instead of AS_AC_EXPAND

See merge request dbus/dbus!364

3 years agoAutotools: use AX_RECURSIVE_EVAL instead of AS_AC_EXPAND
Simon McVittie [Tue, 11 Oct 2022 20:20:50 +0000 (21:20 +0100)] 
Autotools: use AX_RECURSIVE_EVAL instead of AS_AC_EXPAND

AX_RECURSIVE_EVAL is maintained as part of autoconf-archive, so we don't
need to bundle our own copy and keep track of its licensing status.
It's very similar to AS_AC_EXPAND, but the arguments are the other way
round and it doesn't automatically AC_SUBST its result.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'no-pkg-m4' into 'master'
Ralf Habacker [Wed, 12 Oct 2022 06:22:51 +0000 (06:22 +0000)] 
Merge branch 'no-pkg-m4' into 'master'

m4: Stop shipping our own copy of pkg.m4

See merge request dbus/dbus!365

3 years agom4: Stop shipping our own copy of pkg.m4
Simon McVittie [Tue, 11 Oct 2022 20:08:05 +0000 (21:08 +0100)] 
m4: Stop shipping our own copy of pkg.m4

The canonical way to find these macro is to run autogen.sh or autoreconf
while pkg-config (or pkgconf) is installed, which will copy an up-to-date
version of the macros from /usr/share/aclocal. The `make dist` archive
will include a bundled copy of those macros, but the git repository
doesn't need them.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'autolaunch-win' into 'master'
Ralf Habacker [Tue, 11 Oct 2022 18:23:44 +0000 (18:23 +0000)] 
Merge branch 'autolaunch-win' into 'master'

Fixes for test-autolaunch-win

See merge request dbus/dbus!363

3 years agotest-autolaunch-win: Remove redundant check for ERROR message
Simon McVittie [Tue, 11 Oct 2022 17:41:00 +0000 (18:41 +0100)] 
test-autolaunch-win: Remove redundant check for ERROR message

This seems to have been intended to give a more specific error message
if the method call failed, but it will not have been effective, because
dbus_connection_send_with_reply_and_block() ends with a check for ERROR
messages using dbus_set_error_from_message(). This means that if the
reply was an ERROR message, it will already have been converted into a
DBusError by the time call_method() regains control.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest-autolaunch-win: Don't overwrite an error with another error
Simon McVittie [Tue, 11 Oct 2022 17:36:00 +0000 (18:36 +0100)] 
test-autolaunch-win: Don't overwrite an error with another error

An unrelated branch failed CI with this assertion failure:

    26: dbus[6768]: error: arguments to dbus_set_error() were incorrect,
    assertion "(error) == NULL || !dbus_error_is_set ((error))" failed in
    file ...\dbus-errors.c line 365.

Looking at the test, this seems to be the most likely candidate for
this bug in error handling, which is masking whatever the real cause
for the failure was (we can't tell from here). If
dbus_connection_send_with_reply_and_block() returns NULL, then it should
already have set the error.

Fixing this bug in the error handling will hopefully give us a better
error message for the actual failure if it happens again.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'autoconf-runstatedir' into 'master'
Simon McVittie [Tue, 11 Oct 2022 17:53:39 +0000 (17:53 +0000)] 
Merge branch 'autoconf-runstatedir' into 'master'

Use ${runstatedir} for system bus instead of ${localstatedir}/run

Closes #180

See merge request dbus/dbus!209

3 years agoAdd NEWS entries for #180
Simon McVittie [Tue, 26 Jul 2022 10:38:05 +0000 (11:38 +0100)] 
Add NEWS entries for #180

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agospec: Mention that the system bus address might actually be in /run
Simon McVittie [Fri, 15 Jul 2022 16:10:57 +0000 (17:10 +0100)] 
spec: Mention that the system bus address might actually be in /run

The interoperable address is unix:path=/var/run/dbus/system_bus_socket.
However, in most (perhaps all) current Linux distributions, /var/run
is guaranteed to be a symbolic link to /run, and using the path in /run
has some advantages (particularly if automounters are used).

Implementations that intend to be interoperable are not required to
listen on exactly /var/run/dbus/system_bus_socket, as long as clients
that connect to that socket will work correctly. Similarly, clients
are not required to connect to exactly /var/run/dbus/system_bus_socket,
as long as the overall system (consisting of the client and the OSs
that it supports) ensures that it ends up connecting to the same
well-known system bus that is available at
/var/run/dbus/system_bus_socket.

Because of the Unix conventions for how software installs into a prefix,
building a D-Bus implementation with its default build-time
configuration options will not necessarily result in an interoperable
system bus. The system bus is normally shipped by OS distributors,
who should ensure that they have configured it in a way that is
interoperable.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/180
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agobuild: Put system bus socket in runstatedir by default
Issam E. Maghni [Sat, 19 Jun 2021 01:20:21 +0000 (21:20 -0400)] 
build: Put system bus socket in runstatedir by default

This lets OS distributors configure --runstatedir=/run if they want to,
although for interoperability, they should only do this if they can
guarantee that their /run and /var/run are equivalent.

A previous commit adds a warning if we are using the default path on a
system where /run and /var/run are not synoymous, mitigating the
compatibility impact of this change.

For CMake, this requires version 3.9, released in 2017.

For Meson, this is currently controlled by the runtime_dir option,
which defaults to /run if the prefix is /usr. The rationale for this
is that /run is correct for modern Unix systems, and distributors who
switch from Autotools or CMake to Meson need to review all their build
options at that time, which is an ideal opportunity to check that they
are doing the right thing around /run.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/180
Co-authored-by: Simon McVittie <smcv@collabora.com>
3 years agobuild: Show a warning if the system bus socket is not interoperable
Simon McVittie [Wed, 18 May 2022 15:13:36 +0000 (16:13 +0100)] 
build: Show a warning if the system bus socket is not interoperable

We would like to start using ${runstatedir}/dbus/system_bus_socket,
so that distributors who make /var/run a symbolic link to /run will
usually get their dbus-daemon listening on /run/dbus/system_bus_socket,
which has some advantages in corner cases, such as when /var is mediated
by an automounter or is unmounted during system shutdown.

Unfortunately, the interoperable path in the D-Bus Specification is
/var/run/dbus/system_bus_socket for historical reasons (D-Bus is older
than /run), and older versions of Slackware are known to have had /run
and /var/run as distinct directories. Do a check during configuration
to catch systems configured like this and show a warning.

When cross-compiling, this assumes that the system where dbus is built
(the build system in Autotools/Meson, or the "host" in CMake terminology)
has its /var/run and /run set up in a way that is compatible with the
system where dbus will run (the host system in Autotools/Meson, or the
"target" in CMake terminology). This is not 100% correct, but seems good
enough for a warning that will hopefully only trigger for misguided OS
distributors.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agobuild: Update a comment with the release status of Autoconf
Simon McVittie [Wed, 18 May 2022 15:04:40 +0000 (16:04 +0100)] 
build: Update a comment with the release status of Autoconf

It took a while, but Autoconf 2.70 was eventually released.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agobuild: Use AS_IF for system bus socket
Simon McVittie [Wed, 18 May 2022 14:23:01 +0000 (15:23 +0100)] 
build: Use AS_IF for system bus socket

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoUpdate NEWS
Simon McVittie [Tue, 11 Oct 2022 13:19:11 +0000 (14:19 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'spdx-syntax' into 'master'
Simon McVittie [Tue, 11 Oct 2022 13:00:13 +0000 (13:00 +0000)] 
Merge branch 'spdx-syntax' into 'master'

dbus/dbus-macros-internal, test/test-platform-mutex.c: Use upper case for SPDX license operator

See merge request dbus/dbus!360

3 years agodbus/dbus-macros-internal, test/test-platform-mutex.c: Use upper case for SPDX licens...
Ralf Habacker [Thu, 26 May 2022 09:47:58 +0000 (11:47 +0200)] 
dbus/dbus-macros-internal, test/test-platform-mutex.c: Use upper case for SPDX license operator

https://spdx.github.io/spdx-spec/SPDX-license-expressions/ says that
using upper-case operators is canonical.

3 years agoMerge branch 'issue420' into 'master'
Simon McVittie [Tue, 11 Oct 2022 12:55:10 +0000 (12:55 +0000)] 
Merge branch 'issue420' into 'master'

dbus-message: Report OOM as OOM, not InvalidArgs

Closes #420

See merge request dbus/dbus!353

3 years agodbus-message: Report OOM as OOM, not InvalidArgs
Simon McVittie [Fri, 30 Sep 2022 14:08:20 +0000 (15:08 +0100)] 
dbus-message: Report OOM as OOM, not InvalidArgs

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/420
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoUpdate NEWS
Simon McVittie [Tue, 11 Oct 2022 11:53:52 +0000 (12:53 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'dispatch_peer_messages' into 'master'
Simon McVittie [Tue, 11 Oct 2022 11:45:11 +0000 (11:45 +0000)] 
Merge branch 'dispatch_peer_messages' into 'master'

dbus-monitor: Don’t send messages after becoming a monitor

Closes #301

See merge request dbus/dbus!272

3 years agodbus-connection: Test built-in filters
Kai A. Hiller [Mon, 10 Oct 2022 17:44:29 +0000 (19:44 +0200)] 
dbus-connection: Test built-in filters

3 years agodbus-monitor: Disable automatic message filtering
Kai A. Hiller [Mon, 19 Sep 2022 12:31:51 +0000 (14:31 +0200)] 
dbus-monitor: Disable automatic message filtering

3 years agodbus-connection: Add builtin_filters_enabled flag
Kai A. Hiller [Mon, 19 Sep 2022 12:30:35 +0000 (14:30 +0200)] 
dbus-connection: Add builtin_filters_enabled flag

3 years agoMerge branch 'stack-underflow' into 'master'
Simon McVittie [Tue, 11 Oct 2022 10:48:57 +0000 (10:48 +0000)] 
Merge branch 'stack-underflow' into 'master'

config-parser: no longer get past the last NULL passed to locate_attributes

See merge request dbus/dbus!357

3 years agoconfig-parser: no longer get past the last NULL passed to locate_attributes
Evgeny Vereshchagin [Sun, 9 Oct 2022 07:53:02 +0000 (07:53 +0000)] 
config-parser: no longer get past the last NULL passed to locate_attributes

Fixes: bc86794f23fa53
Fixes:
```
==302818==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffd6ac253c0 at pc 0x000000534d0b bp 0x7ffd6ac24e10 sp 0x7ffd6ac24e08
READ of size 8 at 0x7ffd6ac253c0 thread T0
    #0 0x534d0a in locate_attributes /home/vagrant/dbus/build/../bus/config-parser.c:658:16
    #1 0x52ea3f in start_busconfig_child /home/vagrant/dbus/build/../bus/config-parser.c:1080:12
    #2 0x52cca4 in bus_config_parser_start_element /home/vagrant/dbus/build/../bus/config-parser.c:2039:14
    #3 0x52b82b in expat_StartElementHandler /home/vagrant/dbus/build/../bus/config-loader-expat.c:107:8
    #4 0x7f2179f2d2bd  (/lib64/libexpat.so.1+0xd2bd) (BuildId: 0165eed77c910f6ef2227d21afa9c5c5ed5849c2)
    #5 0x7f2179f2aed3  (/lib64/libexpat.so.1+0xaed3) (BuildId: 0165eed77c910f6ef2227d21afa9c5c5ed5849c2)
    #6 0x7f2179f2c9ec  (/lib64/libexpat.so.1+0xc9ec) (BuildId: 0165eed77c910f6ef2227d21afa9c5c5ed5849c2)
    #7 0x7f2179f30a8e in XML_ParseBuffer (/lib64/libexpat.so.1+0x10a8e) (BuildId: 0165eed77c910f6ef2227d21afa9c5c5ed5849c2)
    #8 0x52b040 in bus_config_load /home/vagrant/dbus/build/../bus/config-loader-expat.c:259:9
    #9 0x523c8a in bus_context_new /home/vagrant/dbus/build/../bus/bus.c:828:12
    #10 0x521056 in main /home/vagrant/dbus/build/../bus/main.c:716:13
    #11 0x7f2179a2954f in __libc_start_call_main (/lib64/libc.so.6+0x2954f) (BuildId: 9c5863396a11aab52ae8918ae01a362cefa855fe)
    #12 0x7f2179a29608 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x29608) (BuildId: 9c5863396a11aab52ae8918ae01a362cefa855fe)
    #13 0x42a914 in _start (/home/vagrant/dbus/build/bus/dbus-daemon+0x42a914) (BuildId: df5369f85137975aff9bd398ae859706cc3c52ff)

Address 0x7ffd6ac253c0 is located in stack of thread T0 at offset 0 in frame
    #0 0x52cfaf in start_busconfig_child /home/vagrant/dbus/build/../bus/config-parser.c:733
```

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
3 years agoMerge branch 'clarify-marshalling' into 'master'
Simon McVittie [Sat, 8 Oct 2022 17:12:31 +0000 (17:12 +0000)] 
Merge branch 'clarify-marshalling' into 'master'

Clarify demarshalling code

Closes #413

See merge request dbus/dbus!355

3 years agodbus-marshal-basic: Fix an incorrect comment
Simon McVittie [Tue, 13 Sep 2022 15:02:39 +0000 (16:02 +0100)] 
dbus-marshal-basic: Fix an incorrect comment

We have 16-bit types with 2-byte alignment, but this comment claimed
we only have 1-, 4- or 8-byte alignment. The actual implementation is
fine, and correctly reports 2-byte alignment for the 16-bit types.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus-marshal-basic: Assert that we are in-bounds after skipping items
Simon McVittie [Mon, 12 Sep 2022 12:33:52 +0000 (13:33 +0100)] 
dbus-marshal-basic: Assert that we are in-bounds after skipping items

We recommend disabling assertions in production builds of dbus, so it
is "cheap" to add them even in relatively fast-path locations.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus-marshal-basic: Clarify what is going on when we skip an item
Simon McVittie [Mon, 12 Sep 2022 12:29:38 +0000 (13:29 +0100)] 
dbus-marshal-basic: Clarify what is going on when we skip an item

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus-marshal-validate: Add more comments indicating what is going on
Simon McVittie [Mon, 12 Sep 2022 12:17:55 +0000 (13:17 +0100)] 
dbus-marshal-validate: Add more comments indicating what is going on

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus-marshal-recursive: Correct an incorrect comment
Simon McVittie [Mon, 12 Sep 2022 12:17:09 +0000 (13:17 +0100)] 
dbus-marshal-recursive: Correct an incorrect comment

array_reader_check_finished() no longer returns a type, only a boolean,
so this comment isn't accurate any more.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus-marshal-validate: Add an extra assertion
Simon McVittie [Mon, 12 Sep 2022 12:07:15 +0000 (13:07 +0100)] 
dbus-marshal-validate: Add an extra assertion

We already checked that claimed_len <= (end - p), therefore we can
assume that claimed_len + p <= end. Make this a bit more obvious.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'meson-monotonic-macos' into 'master'
Simon McVittie [Thu, 6 Oct 2022 18:54:10 +0000 (18:54 +0000)] 
Merge branch 'meson-monotonic-macos' into 'master'

Check for more symbols before defining HAVE_CLOCK_MONOTONIC in Meson

Closes #419

See merge request dbus/dbus!352

3 years agoCheck for more symbols before defining HAVE_CLOCK_MONOTONIC in Meson
Jordan Williams [Thu, 6 Oct 2022 13:56:36 +0000 (08:56 -0500)] 
Check for more symbols before defining HAVE_CLOCK_MONOTONIC in Meson

MacOS has limited support for monotonic clock in its pthread implementation.
When building with Meson, `HAVE_MONOTONIC_CLOCK` is defined despite this.
This PR checks for the existence of the missing function `pthread_condattr_setclock`.
To match parity with AutoTools, it also checks for `clock_getres`.

Fixes #419.

3 years agoPost-release version bump
Simon McVittie [Wed, 5 Oct 2022 13:50:05 +0000 (14:50 +0100)] 
Post-release version bump

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoPrepare v1.15.2 dbus-1.15.2
Simon McVittie [Wed, 5 Oct 2022 10:00:56 +0000 (11:00 +0100)] 
Prepare v1.15.2

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoUpdate NEWS
Simon McVittie [Wed, 5 Oct 2022 09:26:35 +0000 (10:26 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest: Parse a message with a byteswapped Unix fd index
Simon McVittie [Fri, 30 Sep 2022 13:01:05 +0000 (14:01 +0100)] 
test: Parse a message with a byteswapped Unix fd index

Reproduces: https://gitlab.freedesktop.org/dbus/dbus/-/issues/417
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest: Add infrastructure to parse valid raw message blobs
Simon McVittie [Fri, 30 Sep 2022 13:00:08 +0000 (14:00 +0100)] 
test: Add infrastructure to parse valid raw message blobs

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus-marshal-byteswap: Byte-swap Unix fd indexes if needed
Simon McVittie [Fri, 30 Sep 2022 12:46:31 +0000 (13:46 +0100)] 
dbus-marshal-byteswap: Byte-swap Unix fd indexes if needed

When a D-Bus message includes attached file descriptors, the body of the
message contains unsigned 32-bit indexes pointing into an out-of-band
array of file descriptors. Some D-Bus APIs like GLib's GDBus refer to
these indexes as "handles" for the associated fds (not to be confused
with a Windows HANDLE, which is a kernel object).

The assertion message removed by this commit is arguably correct up to
a point: fd-passing is only reasonable on a local machine, and no known
operating system allows processes of differing endianness even on a
multi-endian ARM or PowerPC CPU, so it makes little sense for the sender
to specify a byte-order that differs from the byte-order of the recipient.

However, this doesn't account for the fact that a malicious sender
doesn't have to restrict itself to only doing things that make sense.
On a system with untrusted local users, a message sender could crash
the system dbus-daemon (a denial of service) by sending a message in
the opposite endianness that contains handles to file descriptors.

Before this commit, if assertions are enabled, attempting to byteswap
a fd index would cleanly crash the message recipient with an assertion
failure. If assertions are disabled, attempting to byteswap a fd index
would silently do nothing without advancing the pointer p, causing the
message's type and the pointer into its contents to go out of sync, which
can result in a subsequent crash (the crash demonstrated by fuzzing was
a use-after-free, but other failure modes might be possible).

In principle we could resolve this by rejecting wrong-endianness messages
from a local sender, but it's actually simpler and less code to treat
wrong-endianness messages as valid and byteswap them.

Thanks: Evgeny Vereshchagin
Fixes: ba7daa60 "unix-fd: add basic marshalling code for unix fds"
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/417
Resolves: CVE-2022-42012
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest: Add targeted tests for dbus/dbus#413, dbus/dbus#418
Simon McVittie [Mon, 12 Sep 2022 12:28:47 +0000 (13:28 +0100)] 
test: Add targeted tests for dbus/dbus#413, dbus/dbus#418

Unlike the message-internals test, these do not rely on extra debug
instrumentation in libdbus, and so can be used for "as-installed"
testing. (However, they do require GLib.)

Reproduces: https://gitlab.freedesktop.org/dbus/dbus/-/issues/413
Reproduces: https://gitlab.freedesktop.org/dbus/dbus/-/issues/418
Signed-off-by: Simon McVittie <smcv@collabora.com>