platform/upstream/dbus.git
7 years agoIgnore ActivationFailure if not using systemd activation
Simon McVittie [Fri, 7 Oct 2016 20:26:36 +0000 (21:26 +0100)]
Ignore ActivationFailure if not using systemd activation

This isn't security-related, just defensive programming: if
dbus-daemon wasn't run with --systemd-activation, then there is no
reason why systemd would legitimately send us this signal, and if it
does we should just ignore it.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98157

7 years agobus_driver_handle_message: reject ActivationFailure if unprivileged
Simon McVittie [Fri, 7 Oct 2016 20:25:08 +0000 (21:25 +0100)]
bus_driver_handle_message: reject ActivationFailure if unprivileged

Specifically, this will allow ActivationFailure messages from our
own uid or from root, but reject them otherwise, even if the bus
configuration for who can own org.freedesktop.systemd1 is entirely
wrong due to something like CVE-2014-8148.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98157

7 years agodbus_activation_systemd_failure: do not use non-literal format string
Simon McVittie [Fri, 7 Oct 2016 18:13:01 +0000 (19:13 +0100)]
dbus_activation_systemd_failure: do not use non-literal format string

In principle this could lead to arbitrary memory overwrite via
a format string attack in the message received from systemd,
resulting in arbitrary code execution.

This is not believed to be an exploitable security vulnerability on the
system bus in practice: it can only be exploited by the owner of the
org.freedesktop.systemd1 bus name, which is restricted to uid 0, so
if systemd is attacker-controlled then the system is already doomed.
Similarly, if a systemd system unit mentioned in the activation failure
message has an attacker-controlled name, then the attacker likely already
has sufficient access to execute arbitrary code as root in any case.

However, prior to dbus 1.8.16 and 1.9.10, due to a missing check for
systemd's identity, unprivileged processes could forge activation
failure messages which would have gone through this code path.
We thought at the time that this was a denial of service vulnerability
(CVE-2015-0245); this bug means that it was in fact potentially an
arbitrary code execution vulnerability.

Bug found using -Wsuggest-attribute=format and -Wformat-security.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98157

7 years agoupdate NEWS
Simon McVittie [Wed, 5 Oct 2016 18:34:55 +0000 (19:34 +0100)]
update NEWS

7 years agobus: Add LSM label to connection loginfo string
Philip Withnall [Tue, 4 Oct 2016 17:39:11 +0000 (18:39 +0100)]
bus: Add LSM label to connection loginfo string

If it is set (i.e. if an LSM is in use) this will make it appear in
various places in log output.

With SELinux, for example, this appends something like:
   label="system_u:object_r:unlabeled_t:s0"

This commit partially rearranges the code which sets the loginfo string,
so that it consistently puts a space between fields, and not one at the
end.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68212
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agobus: Add sender name to bus activation log messages
Philip Withnall [Sat, 1 Oct 2016 13:59:47 +0000 (15:59 +0200)]
bus: Add sender name to bus activation log messages

This clarifies
   Activating via systemd: service name='com.example.Example'
   unit='example.service'
to
   Activating via systemd: service name='com.example.Example'
   unit='example.service' requested by ':1.23' (uid 1000 pid 123
   comm "whatever-activat")

Similarly for the non-systemd code paths.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68212
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoFix double printing function name in _dbus_verbose() messages.
Ralf Habacker [Wed, 5 Oct 2016 11:00:49 +0000 (13:00 +0200)]
Fix double printing function name in _dbus_verbose() messages.

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98089

7 years agoUpdate NEWS
Simon McVittie [Wed, 5 Oct 2016 09:09:11 +0000 (10:09 +0100)]
Update NEWS

7 years agodoc: Install introspection and busconfig DTDs
Philip Withnall [Sat, 1 Oct 2016 19:23:16 +0000 (21:23 +0200)]
doc: Install introspection and busconfig DTDs

Install them to $(datadir)/xml/dbus-1, which seems to be the standard
location for installed DTDs. This means that developers can use them to
validate their introspection XML, and sysadmins can use them to validate
their bus configuration files.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89011
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoMerge branch 'dbus-1.10'
Simon McVittie [Tue, 4 Oct 2016 10:23:49 +0000 (11:23 +0100)]
Merge branch 'dbus-1.10'

7 years agoNEWS
Simon McVittie [Tue, 4 Oct 2016 10:23:30 +0000 (11:23 +0100)]
NEWS

7 years agoDBusMessage: Fix UB (misaligned access) in call to _dbus_header_set_field_basic()
Marc Mutz [Mon, 3 Oct 2016 20:19:45 +0000 (22:19 +0200)]
DBusMessage: Fix UB (misaligned access) in call to _dbus_header_set_field_basic()

The const void* 'value' pointer that is passed the address of a
uint32_t here eventually ends up in _dbus_marshal_write_basic(), which
casts it to a DBusBasicValue, a union type that has an alignment of
eight on 64-bit platforms and is therefore more-aligned than the
uint32.

The read of a value of a more-aligned type through a pointer to a less
-aligned type is undefined behaviour.

Fix by storing the uint32 in a DBusBasicValue and passing that instead.

Found by UBSan:

  dbus/dbus/dbus-marshal-basic.c:832:14: runtime error: member access within misaligned address 0x7fdb8dac3a04 for type 'const union DBusBasicValue', which requires 8 byte alignment
  0x7fdb8dac3a04: note: pointer points here
    4a 87 b5 71 01 00 00 00  40 7d 01 00 00 61 00 00  10 3b ac 8d db 7f 00 00  2c 2a 3e 94 db 7f 00 00
                ^
    #0 0x7fdb9444a2c3 in _dbus_marshal_write_basic dbus/dbus/dbus-marshal-basic.c:832
    #1 0x7fdb943d22fb in _dbus_type_writer_write_basic_no_typecode dbus/dbus/dbus-marshal-recursive.c:1605
    #2 0x7fdb943d64e9 in _dbus_type_writer_write_basic dbus/dbus/dbus-marshal-recursive.c:2327
    #3 0x7fdb943c52a6 in write_basic_field dbus/dbus/dbus-marshal-header.c:318
    #4 0x7fdb943c919e in _dbus_header_set_field_basic dbus/dbus/dbus-marshal-header.c:1321
    #5 0x7fdb943e1349 in dbus_message_set_reply_serial dbus/dbus/dbus-message.c:1173

Signed-off-by: Marc Mutz <marc@kdab.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98035

7 years agoMerge branch 'dbus-1.10'
Simon McVittie [Mon, 3 Oct 2016 10:43:55 +0000 (11:43 +0100)]
Merge branch 'dbus-1.10'

7 years agoNEWS for 1.10.x
Simon McVittie [Mon, 3 Oct 2016 10:43:06 +0000 (11:43 +0100)]
NEWS for 1.10.x

7 years agoautogen.sh: fail cleanly if autoconf fails
Simon McVittie [Mon, 15 Aug 2016 19:11:49 +0000 (20:11 +0100)]
autogen.sh: fail cleanly if autoconf fails

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
(cherry picked from commit 0bbfca6def7a39c03b7a0a4cba166fdf89f3c630)

7 years agoNEWS for 1.11.x
Simon McVittie [Mon, 3 Oct 2016 10:42:19 +0000 (11:42 +0100)]
NEWS for 1.11.x

7 years agospec: Allow <annotation> in <arg> elements in introspection XML
Philip Withnall [Sat, 1 Oct 2016 11:47:27 +0000 (13:47 +0200)]
spec: Allow <annotation> in <arg> elements in introspection XML

This is widely used in practice (especially by GLib — just look at files
in /usr/share/dbus-1/interfaces/), and there is no reason not to allow
it. Update the specification, introspection DTD and XSL file to allow
and represent it.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86162
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agodoc: Add missing space in introspect.xsl
Philip Withnall [Sat, 1 Oct 2016 11:46:38 +0000 (13:46 +0200)]
doc: Add missing space in introspect.xsl

This adds a space in the output between ‘annotation’ and the key of the
annotation. A Saturday afternoon cosmetic fix.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86162
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agospec: Recommend against using ‘/’ for object paths
Philip Withnall [Sat, 1 Oct 2016 11:22:30 +0000 (13:22 +0200)]
spec: Recommend against using ‘/’ for object paths

As discussed in http://0pointer.de/blog/projects/versioning-dbus.html
and in https://dbus.freedesktop.org/doc/dbus-api-design.html,
un-versioned object paths make it hard to work out which interface a
signal was emitted from.

Clarify this in the specification to try and avoid people making this
mistake.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37095
Reviewed-by: Simon McVittie <smcv@debian.org>
7 years agoRemove unmatched parenthesis
Simon McVittie [Thu, 11 Aug 2016 14:39:52 +0000 (15:39 +0100)]
Remove unmatched parenthesis

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years agoRemove trailing newlines from _dbus_warn, _dbus_warn_check_failed
Simon McVittie [Thu, 21 Jul 2016 10:01:01 +0000 (11:01 +0100)]
Remove trailing newlines from _dbus_warn, _dbus_warn_check_failed

They used to be needed, but are not needed any more, and we were
never completely consistent about including them in any case.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agointernals: remove newline, pid from assertion failures
Simon McVittie [Thu, 21 Jul 2016 09:55:59 +0000 (10:55 +0100)]
internals: remove newline, pid from assertion failures

_dbus_warn() now calls _dbus_logv() which always logs the pid and
prints a newline anyway.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years agodbus-launch: redirect dbus-daemon output to syslog
Simon McVittie [Thu, 21 Jul 2016 09:25:01 +0000 (10:25 +0100)]
dbus-launch: redirect dbus-daemon output to syslog

Otherwise, it won't go anywhere at all.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agoOnly redirect child processes to systemd Journal if using syslog
Simon McVittie [Thu, 21 Jul 2016 09:21:35 +0000 (10:21 +0100)]
Only redirect child processes to systemd Journal if using syslog

In particular this means the test suite won't spam the Journal
any more.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years agodbus-daemon: add --syslog, --nosyslog, --syslog-only
Simon McVittie [Wed, 20 Jul 2016 09:04:50 +0000 (10:04 +0100)]
dbus-daemon: add --syslog, --nosyslog, --syslog-only

Like --fork and --nofork, these override what the configuration says.

Use --syslog-only to force the systemd services to log to the Journal
(via syslog, which means we see the severity metadata) instead of
testing sd_booted() in the configuration implementation.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agosyslog test: extend assertions to cover new functionality
Simon McVittie [Thu, 11 Aug 2016 14:31:41 +0000 (15:31 +0100)]
syslog test: extend assertions to cover new functionality

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years ago_dbus_warn, _dbus_warn_check_failed: unify with _dbus_logv
Simon McVittie [Wed, 20 Jul 2016 08:25:57 +0000 (09:25 +0100)]
_dbus_warn, _dbus_warn_check_failed: unify with _dbus_logv

This means that dbus-daemon will log something like

    dbus-daemon[123]: Unable to add reload watch to main loop

to syslog and/or stderr according to its configuration, while other
libdbus users will print something like this to stderr:

    dbus[4567]: arguments to dbus_foo() were incorrect, assertion
    "connection != NULL" failed at file dbus-foo.c line 123.
    This is normally a bug in some application using the D-Bus library.

This slightly changes the meaning of the argument to _dbus_warn()
and _dbus_warn_check_failed. Previously, a trailing newline was
expected, and a missing newline would have resulted in incorrect
output. Now, a newline is supplied automatically by the
library (like g_warning()), and messages that end with a newline will
result in an unnecessary extra newline in output.

This extra newline is harmless, so I'm not going to change all the
callers immediately.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agobus_context_log: remove special handling of !context->syslog
Simon McVittie [Wed, 20 Jul 2016 08:28:02 +0000 (09:28 +0100)]
bus_context_log: remove special handling of !context->syslog

_dbus_log() and _dbus_logv() are always the right functions to call now.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years ago_dbus_logv: configurably log to syslog and/or stderr
Simon McVittie [Fri, 12 Aug 2016 16:59:45 +0000 (17:59 +0100)]
_dbus_logv: configurably log to syslog and/or stderr

This changes the behaviour of _dbus_logv() if _dbus_init_system_log() was
not called. Previously, _dbus_logv() would always log to syslog;
additionally, it would log to stderr, unless the process is dbus-daemon
and it was started by systemd. Now, it will log to stderr only,
unless _dbus_init_system_log() was called first.

This is the desired behaviour because when we hook up
_dbus_warn_check_failed() to _dbus_logv() in the next commit, we don't
want typical users of libdbus to start logging their check failures to
syslog - we only want the dbus-daemon to do that.

In practice this is not usually a behaviour change, because there was
only one situation in which we called _dbus_logv() without first calling
_dbus_init_system_log(), namely an error while parsing configuration
files. Initialize the system log "just in time" in that situation
to preserve existing behaviour.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agoUpdate autoconf-archive, and use snapshot.debian.org
Simon McVittie [Fri, 30 Sep 2016 18:35:59 +0000 (19:35 +0100)]
Update autoconf-archive, and use snapshot.debian.org

This way the link won't expire in future.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agoFix building with CMake for a Unix platform where functions like recv() are in a...
Ralf Habacker [Wed, 17 Aug 2016 16:43:41 +0000 (18:43 +0200)]
Fix building with CMake for a Unix platform where functions like recv() are in a separate -lsocket, like QNX.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94096
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoFix building with CMake for a Unix platform that does not have -lrt, such as Android.
Ralf Habacker [Wed, 17 Aug 2016 16:42:02 +0000 (18:42 +0200)]
Fix building with CMake for a Unix platform that does not have -lrt, such as Android.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94096
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoDocument default limits in system.conf.in
Simon McVittie [Tue, 18 Nov 2014 13:46:39 +0000 (13:46 +0000)]
Document default limits in system.conf.in

I left them commented out to minimize the impact if we change them in
one place and not the other, but we should try to keep them in sync
anyway.

7 years agoLog max_pending_service_starts (aka max_pending_activations) when exceeded
Simon McVittie [Tue, 18 Nov 2014 12:35:28 +0000 (12:35 +0000)]
Log max_pending_service_starts (aka max_pending_activations) when exceeded

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442

7 years agoLog service_start_timeout (aka activation_timeout) when we exceed it
Simon McVittie [Tue, 18 Nov 2014 19:12:01 +0000 (19:12 +0000)]
Log service_start_timeout (aka activation_timeout) when we exceed it

Also upgrade it to a warning.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442

7 years agodbus-daemon test: exercise pending fd timeout test
Simon McVittie [Tue, 16 Aug 2016 17:27:43 +0000 (18:27 +0100)]
dbus-daemon test: exercise pending fd timeout test

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoLog to syslog when pending_fd_timeout is exceeded
Simon McVittie [Tue, 16 Aug 2016 15:12:35 +0000 (16:12 +0100)]
Log to syslog when pending_fd_timeout is exceeded

This is either a denial-of-service attempt, a pathological performance
problem or a dbus-daemon bug. Sysadmins should be told about any of
these.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
[smcv: add units to timeout: it is in milliseconds]
Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agodbus-daemon test: exercise max_names_per_connection limit
Simon McVittie [Fri, 1 Jul 2016 12:17:23 +0000 (13:17 +0100)]
dbus-daemon test: exercise max_names_per_connection limit

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoLog when we exceed max_names_per_connection (aka max_services_per_connection)
Simon McVittie [Tue, 18 Nov 2014 19:19:37 +0000 (19:19 +0000)]
Log when we exceed max_names_per_connection (aka max_services_per_connection)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442

7 years agodbus-daemon test: exercise maximum match rules per connection
Simon McVittie [Fri, 1 Jul 2016 12:07:49 +0000 (13:07 +0100)]
dbus-daemon test: exercise maximum match rules per connection

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoLog when we exceed max_match_rules_per_connection
Simon McVittie [Tue, 18 Nov 2014 19:19:16 +0000 (19:19 +0000)]
Log when we exceed max_match_rules_per_connection

7 years agodbus-daemon test: exercise maximum replies per connection
Simon McVittie [Fri, 1 Jul 2016 12:02:04 +0000 (13:02 +0100)]
dbus-daemon test: exercise maximum replies per connection

This time we're doing so deliberately.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agodbus-daemon test: avoid reaching pending reply limit
Simon McVittie [Fri, 1 Jul 2016 11:38:33 +0000 (12:38 +0100)]
dbus-daemon test: avoid reaching pending reply limit

We were not actually doing what was intended (flooding the bus with
10k or 100k messages for the other side) because the bus was limiting
the sender to 128 parallel method calls.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoLog when we exceed max_replies_per_connection
Simon McVittie [Tue, 18 Nov 2014 19:18:47 +0000 (19:18 +0000)]
Log when we exceed max_replies_per_connection

7 years agodbus-daemon test: exercise maximum connection counts
Simon McVittie [Fri, 1 Jul 2016 11:30:22 +0000 (12:30 +0100)]
dbus-daemon test: exercise maximum connection counts

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoLog to syslog if max_completed_connections or max_connections_per_user are exceeded
Simon McVittie [Fri, 1 Jul 2016 10:53:17 +0000 (11:53 +0100)]
Log to syslog if max_completed_connections or max_connections_per_user are exceeded

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=86442

7 years agoOnly compile test-bus-launch-helper, etc. if embedded tests are enabled
Simon McVittie [Thu, 11 Feb 2016 20:43:23 +0000 (20:43 +0000)]
Only compile test-bus-launch-helper, etc. if embedded tests are enabled

These source files are specific to the embedded tests and make no sense
otherwise.

Also remove a comment in the CMake build system about fixing the
build of the activation helper on Windows: the activation helper
is Unix-specific and always will be, since it relies on Unix setuid
to function.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94094

7 years agoMerge remote-tracking branch 'github/master'
Simon McVittie [Mon, 15 Aug 2016 23:25:01 +0000 (00:25 +0100)]
Merge remote-tracking branch 'github/master'

7 years ago1.11.5
Simon McVittie [Mon, 15 Aug 2016 23:21:48 +0000 (00:21 +0100)]
1.11.5

7 years agoMerge remote-tracking branch 'origin/master'
Simon McVittie [Mon, 15 Aug 2016 23:21:19 +0000 (00:21 +0100)]
Merge remote-tracking branch 'origin/master'

7 years ago1.10.11
Simon McVittie [Mon, 15 Aug 2016 22:31:18 +0000 (23:31 +0100)]
1.10.11

7 years ago1.11.4
Simon McVittie [Mon, 15 Aug 2016 20:44:06 +0000 (21:44 +0100)]
1.11.4

7 years agoMerge branch 'dbus-1.10'
Simon McVittie [Mon, 15 Aug 2016 20:38:52 +0000 (21:38 +0100)]
Merge branch 'dbus-1.10'

7 years agoTravis-CI: fetch a newer autoconf-archive from Debian
Simon McVittie [Mon, 15 Aug 2016 19:41:28 +0000 (20:41 +0100)]
Travis-CI: fetch a newer autoconf-archive from Debian

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoTravis-CI: install new autoconf-archive build-dependency
Simon McVittie [Mon, 15 Aug 2016 19:12:19 +0000 (20:12 +0100)]
Travis-CI: install new autoconf-archive build-dependency

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoautogen.sh: fail cleanly if autoconf fails
Simon McVittie [Mon, 15 Aug 2016 19:11:49 +0000 (20:11 +0100)]
autogen.sh: fail cleanly if autoconf fails

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years ago1.10.10
Simon McVittie [Mon, 15 Aug 2016 18:59:18 +0000 (19:59 +0100)]
1.10.10

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agoname-test, tools: add missing COVERAGE_CFLAGS
Simon McVittie [Mon, 15 Aug 2016 14:15:13 +0000 (15:15 +0100)]
name-test, tools: add missing COVERAGE_CFLAGS

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoDocument use of AX_CODE_COVERAGE
Simon McVittie [Mon, 15 Aug 2016 13:29:56 +0000 (14:29 +0100)]
Document use of AX_CODE_COVERAGE

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agoUse AX_CODE_COVERAGE for test-coverage statistics
Thomas Zimmermann [Fri, 12 Aug 2016 08:50:53 +0000 (10:50 +0200)]
Use AX_CODE_COVERAGE for test-coverage statistics

DBus uses custom rules in its Makefiles to implement test-coverage
statistics.

This patch implements test-coverage statistics with the autoconf macro
AX_CODE_COVERAGE. The script automatically tests for tools (e.g., gcov,
lcov), sets build variables and creates Makefile rules.

Run 'configure' with '--enable-code-coverage' to enable support for
test-coverage statistics. Run 'make check-code-coverage' to run the
tests and generate the statistics.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
[smcv: do not alter compiler.m4; move AM_CXXFLAGS to the one place we
compile C++]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88922

7 years agoMerge branch 'dbus-1.10'
Simon McVittie [Fri, 12 Aug 2016 17:24:10 +0000 (18:24 +0100)]
Merge branch 'dbus-1.10'

7 years agoAdd a regression test for dbus-launch in X11
Simon McVittie [Fri, 12 Aug 2016 09:58:13 +0000 (10:58 +0100)]
Add a regression test for dbus-launch in X11

[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agotest-dbus-daemon-fork: exercise closed stdin, stdout, stderr
Simon McVittie [Wed, 20 Jul 2016 12:31:50 +0000 (13:31 +0100)]
test-dbus-daemon-fork: exercise closed stdin, stdout, stderr

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agotest: expand dbus-launch-eval test to cover stdin being closed
Simon McVittie [Wed, 20 Jul 2016 11:07:03 +0000 (12:07 +0100)]
test: expand dbus-launch-eval test to cover stdin being closed

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agoAdd a simple test for dbus-daemon --fork
Simon McVittie [Wed, 20 Jul 2016 12:12:45 +0000 (13:12 +0100)]
Add a simple test for dbus-daemon --fork

[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agotest: add a regression test for eval "$(dbus-launch --sh-syntax)"
Simon McVittie [Wed, 20 Jul 2016 11:00:34 +0000 (12:00 +0100)]
test: add a regression test for eval "$(dbus-launch --sh-syntax)"

[Modified for the dbus-1.10 branch: DBUS_USE_TEST_BINARY is needed.]

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agotest-dbus-launch-x11: extend to cover --exit-with-x11
Simon McVittie [Fri, 12 Aug 2016 10:12:59 +0000 (11:12 +0100)]
test-dbus-launch-x11: extend to cover --exit-with-x11

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agoAdd a regression test for dbus-launch in X11
Simon McVittie [Fri, 12 Aug 2016 09:58:13 +0000 (10:58 +0100)]
Add a regression test for dbus-launch in X11

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008

7 years agotest-dbus-daemon-fork: exercise closed stdin, stdout, stderr
Simon McVittie [Wed, 20 Jul 2016 12:31:50 +0000 (13:31 +0100)]
test-dbus-daemon-fork: exercise closed stdin, stdout, stderr

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008

7 years agoAdd a simple test for dbus-daemon --fork
Simon McVittie [Wed, 20 Jul 2016 12:12:45 +0000 (13:12 +0100)]
Add a simple test for dbus-daemon --fork

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Colin Walters
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008

7 years agotest: add a regression test for eval "$(dbus-launch --sh-syntax)"
Simon McVittie [Wed, 20 Jul 2016 11:00:34 +0000 (12:00 +0100)]
test: add a regression test for eval "$(dbus-launch --sh-syntax)"

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008

7 years ago_dbus_change_to_daemon_user (audit code path): set DBusError correctly
Simon McVittie [Thu, 21 Jul 2016 09:55:06 +0000 (10:55 +0100)]
_dbus_change_to_daemon_user (audit code path): set DBusError correctly

The other error cases here all set the error instead of just warning.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years agoRemove trailing newlines from _dbus_assert_not_reached
Simon McVittie [Thu, 21 Jul 2016 09:59:50 +0000 (10:59 +0100)]
Remove trailing newlines from _dbus_assert_not_reached

This was never necessary: _dbus_assert_not_reached() always added one.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years agodbus-daemon, dbus-launch: cope with callers having closed standard fds
Simon McVittie [Thu, 21 Jul 2016 07:24:38 +0000 (08:24 +0100)]
dbus-daemon, dbus-launch: cope with callers having closed standard fds

In Debian bug <https://bugs.debian.org/829348>, lightdm appears to
have been starting dbus-launch with at least one of the three
standard fds 0, 1, 2 (stdin, stdout, stderr) closed. This resulted
in the dbus-daemon's epoll_create1() returning a fd less than 3.
Later, _dbus_become_daemon() replaces fds 0-2 with /dev/null. As a
result, a subsequent call to _dbus_loop_add_watch() for the reload
pipe resulted in calling epoll_ctl on the non-epoll fd pointing to
/dev/null, which fails with EINVAL, resulting in the dbus-daemon
exiting unsuccessfully.

Unix programs are not normally expected to behave correctly when
launched with the standard fds not already open; but at the same time,
X11 autolaunching means that dbus-launch (and hence the dbus-daemon)
can get started from an arbitrarily precarious situation.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
(cherry picked from commit c8f73a2a3a9d9d10587f596a62ebb64e8963197e)

7 years ago_dbus_ensure_standard_fds: new function to ensure std* fds are open
Simon McVittie [Thu, 21 Jul 2016 07:23:12 +0000 (08:23 +0100)]
_dbus_ensure_standard_fds: new function to ensure std* fds are open

This function opens stdin, stdout, stderr pointing to /dev/null
if they aren't already open. Optionally, it can also replace
whatever is available on those fds with /dev/null.

To allow for use in contexts where only async-signal-safe functions
should be used, such as between fork() and a following exec(),
this function does not use conventional libdbus error handling
(which would require malloc). Instead, it sets errno and returns
an explanatory string.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
(cherry picked from commit 69123a6bd2adabbaec1f770fc4573fc3ed4ceca6)

7 years agovarious tests: produce better diagnostics on error
Simon McVittie [Mon, 11 Jul 2016 10:09:26 +0000 (11:09 +0100)]
various tests: produce better diagnostics on error

Same root cause as <https://bugs.freedesktop.org/show_bug.cgi?id=96653>:
we didn't check whether the message was in fact an error reply.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agoMore NEWS for 1.11
Simon McVittie [Fri, 12 Aug 2016 09:17:46 +0000 (10:17 +0100)]
More NEWS for 1.11

7 years agoMerge branch 'dbus-1.10'
Simon McVittie [Fri, 12 Aug 2016 09:14:46 +0000 (10:14 +0100)]
Merge branch 'dbus-1.10'

7 years agoNEWS for 1.10
Simon McVittie [Fri, 12 Aug 2016 09:12:28 +0000 (10:12 +0100)]
NEWS for 1.10

7 years agoMark WaitingForOK state as unused
Simon McVittie [Thu, 11 Aug 2016 15:08:39 +0000 (16:08 +0100)]
Mark WaitingForOK state as unused

It should probably be used (see #97298) but the fact that it isn't
is breaking compatibility with gcc 6, so apply a quick workaround
while we look into what's wrong here.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282
(cherry picked from commit 21d61180819c141e779d6ecf9919e62e768b6fd9)

7 years agoupdate-activation-environment: produce better diagnostics on error
Simon McVittie [Mon, 11 Jul 2016 09:52:44 +0000 (10:52 +0100)]
update-activation-environment: produce better diagnostics on error

If dbus-daemon or systemd replied to our method call with an error,
we would report it as "invalid arguments" instead of the true error
name and message.

Same root cause as <https://bugs.freedesktop.org/show_bug.cgi?id=96653>.

Signed-off-by: Simon McVittie <smcv@debian.org>
7 years agoconfig-parser: remove unnecessary newline from _dbus_log()
Simon McVittie [Wed, 20 Jul 2016 07:55:55 +0000 (08:55 +0100)]
config-parser: remove unnecessary newline from _dbus_log()

_dbus_log() already adds a newline.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years ago_dbus_system_log: rename to _dbus_log
Simon McVittie [Wed, 20 Jul 2016 07:55:14 +0000 (08:55 +0100)]
_dbus_system_log: rename to _dbus_log

This is a step towards making it write to either stderr or syslog
or both, as configured globally.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years ago_dbus_init_system_log: record a syslog tag (executable name)
Simon McVittie [Thu, 21 Jul 2016 09:29:10 +0000 (10:29 +0100)]
_dbus_init_system_log: record a syslog tag (executable name)

Instead of hard-coding "dbus", report what the executable really is.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years agosysdeps: move _dbus_system_log() into the shared library
Simon McVittie [Wed, 20 Jul 2016 09:07:12 +0000 (10:07 +0100)]
sysdeps: move _dbus_system_log() into the shared library

This is in preparation for optionally making _dbus_warn() use it.
dbus-daemon closes its stderr under some circumstances, including
when launched by dbus-launch, which makes failures in that
situation rather hard to debug.

_dbus_system_log() is the same on Unix and Windows, so move it
to dbus-sysdeps.c. _dbus_system_logv() remains platform-specific.

Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009
[smcv: move the #include for syslog.h, too]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
7 years agotest-bus: don't write to the syslog
Simon McVittie [Wed, 20 Jul 2016 09:14:51 +0000 (10:14 +0100)]
test-bus: don't write to the syslog

We want to emulate the behaviour of the system bus, but we don't
really want to spam the system log with lots of test messages.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

7 years agoFix misleading indentation to avoid respective compiler warning
Thomas Zimmermann [Tue, 9 Aug 2016 16:22:04 +0000 (18:22 +0200)]
Fix misleading indentation to avoid respective compiler warning

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

7 years agoProtect 'i' in _handle_inotify_watch by DBUS_ENABLE_VERBOSE_MODE
Thomas Zimmermann [Tue, 9 Aug 2016 16:19:56 +0000 (18:19 +0200)]
Protect 'i' in _handle_inotify_watch by DBUS_ENABLE_VERBOSE_MODE

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

7 years agoInitialize 'klass' in _dbus_type_reader_recurse to NULL
Thomas Zimmermann [Tue, 9 Aug 2016 14:48:59 +0000 (16:48 +0200)]
Initialize 'klass' in _dbus_type_reader_recurse to NULL

Initializing 'klass' in _dbus_type_reader_recurse avoids a
compile-time warning about the variable being uninitialized.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

7 years agoProtect 'orig_len' in recover_unused_bytes by DBUS_ENABLE_VERBOSE_MODE
Thomas Zimmermann [Tue, 9 Aug 2016 16:26:56 +0000 (18:26 +0200)]
Protect 'orig_len' in recover_unused_bytes by DBUS_ENABLE_VERBOSE_MODE

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

7 years agodbus-launch: Protect concat2 by DBUS_ENABLE_EMBEDDED_TESTS
Thomas Zimmermann [Tue, 9 Aug 2016 16:15:25 +0000 (18:15 +0200)]
dbus-launch: Protect concat2 by DBUS_ENABLE_EMBEDDED_TESTS

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

7 years agoMark WaitingForOK state as unused
Simon McVittie [Thu, 11 Aug 2016 15:08:39 +0000 (16:08 +0100)]
Mark WaitingForOK state as unused

It should probably be used (see #97298) but the fact that it isn't
is breaking compatibility with gcc 6, so apply a quick workaround
while we look into what's wrong here.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97282

8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Fri, 29 Jul 2016 18:15:21 +0000 (19:15 +0100)]
Merge branch 'dbus-1.10'

8 years agoNEWS for 1.10 branch
Simon McVittie [Fri, 29 Jul 2016 18:14:18 +0000 (19:14 +0100)]
NEWS for 1.10 branch

8 years agoconfigure.ac: explicitely check stdint.h
Ioan-Adrian Ratiu [Thu, 28 Jul 2016 22:19:37 +0000 (01:19 +0300)]
configure.ac: explicitely check stdint.h

Otherwise HAVE_STDINT_H will not be defined or the var will not be
picked up from cache so builds could fail with errors like:
| ../../dbus-1.10.8/dbus/dbus-internals.h:239:8: error: ‘uintptr_t’ undeclared (first use in this function)

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
[smcv: fix Autoconf underquoting]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoMerge branch 'dbus-1.10'
Simon McVittie [Mon, 25 Jul 2016 11:11:39 +0000 (12:11 +0100)]
Merge branch 'dbus-1.10'

8 years agoUpdate NEWS for 1.11
Simon McVittie [Mon, 25 Jul 2016 11:11:00 +0000 (12:11 +0100)]
Update NEWS for 1.11

8 years agoUpdate NEWS for merge of dbus-1.10-ci branch
Simon McVittie [Mon, 25 Jul 2016 10:53:13 +0000 (11:53 +0100)]
Update NEWS for merge of dbus-1.10-ci branch

8 years agoMerge branch 'dbus-1.10-ci' into dbus-1.10
Simon McVittie [Mon, 25 Jul 2016 10:43:54 +0000 (11:43 +0100)]
Merge branch 'dbus-1.10-ci' into dbus-1.10

8 years ago_read_subprocess_line_argv: use _dbus_ensure_standard_fds
Simon McVittie [Thu, 21 Jul 2016 07:27:36 +0000 (08:27 +0100)]
_read_subprocess_line_argv: use _dbus_ensure_standard_fds

This also gives us an opportunity to improve the error reporting.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>