Commit graph

5227 commits

Author SHA1 Message Date
Simon McVittie
ee1940f307 doc: Remove obsolete message about man2html
We no longer run man2html.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit f134e2d2c7)
2018-12-04 12:28:05 +00:00
Simon McVittie
700cec5485 CONTRIBUTING.md: Update and rewrite
This file hadn't kept up with reality, and needs updating for Gitlab.
Take the opportunity to rewrite it.

Much of the text, particularly about commit messages, was taken from
Wayland's contributing guide (thanks to Ander Conselvan de Oliveira,
Bryce Harrington, Eric Engestrom, Pekka Paalanen and Daniel Stone).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-04 11:13:54 +00:00
Simon McVittie
215ebadb90 CONTRIBUTING: Reformat as Markdown
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-04 11:13:44 +00:00
Simon McVittie
6d09d6b155 CONTRIBUTING: Remove all trailing whitespace
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-04 11:13:28 +00:00
Simon McVittie
64d7fa2713 Rename HACKING to CONTRIBUTING
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-04 11:13:05 +00:00
Simon McVittie
dc85541a9b NEWS: Refer to Gitlab
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-03 16:35:37 +00:00
Simon McVittie
7f9966ede8 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-12-03 16:32:32 +00:00
Simon McVittie
aa42766340 activation: Don't leak if delivering activation message is forbidden
This is technically a denial of service because the dbus-daemon will
run out of memory eventually, but it's a very slow and noisy one,
because all the rejected messages are also very likely to have
been logged to the system log.

Detected by AddressSanitizer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/234
Reviewed-by: pwithnall
2018-12-03 16:32:31 +00:00
Simon McVittie
a6bae612ad Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-16 15:09:39 +00:00
Simon McVittie
ffa3bc17a7 dbus-daemon test: Allow much longer for pending fd timeout
The timeout we're using here is 0.5s (500ms), but the actual time taken
is unbounded, because the OS scheduler might not schedule our process
for an arbitrary length of time after we become runnable.

We previously allowed up to 1 second, but in the CI jobs for dbus!9
and dbus!18 we've seen this take up to 3.4 seconds (presumably
because other tests, or other jobs running on the same shared
infrastructure, starved this process). Allow up to 10 seconds to guard
against spurious failures.

The timeout used in the production system.conf is 150 seconds (2½
minutes), and we're only using the shorter 500ms timeout here to make
the test complete more quickly, so ±10 seconds is relatively
insignificant: the main thing is that it's finite.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 20e6eb7cd1)
2018-11-16 15:09:06 +00:00
Simon McVittie
6cb51b22fa build: Never use poll() on Darwin family (macOS, etc.) or Interix
Doing a runtime check in configure.ac (AC_RUN_IFELSE) has several
disadvantages:

* It doesn't work when cross-compiling. For example, if we build macOS
  binaries on a Linux system, we'd assume that poll() works, but in
  fact it won't.

* It checks the build system capabilities, but that is not necessarily
  appropriate if (for example) a macOS 10.10 user builds binaries that
  could be used by macOS 10.12 or macOS 10.9 users.

* It checks for one specific failure mode, but macOS seems to have a
  history of various implementation issues in poll().

* If we want it to work in CMake, we have to duplicate it in the CMake
  build system.

None of these is a showstopper on its own, but the combination of all
of them makes the current approach to avoiding the broken poll() on
macOS look unreliable. libcurl, a widely-portable library making
extensive use of sockets, specifically doesn't use poll() on Darwin
(macOS, iOS, etc.) or on Interix; let's follow their example here.

See also https://bugzilla.gnome.org/show_bug.cgi?id=302672 and
https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/
for some relevant history.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/232
(cherry picked from commit 0414ea65ca)
2018-11-16 15:07:39 +00:00
Simon McVittie
a2a8510e8e Update NEWS 2018-10-05 12:34:38 +01:00
Simon McVittie
c21471dde5 ci: Use a separate ccache for each CI job
This should avoid them overwriting each other.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit e3fb085886)
2018-10-04 18:48:04 +01:00
Simon McVittie
6bae26d314 ci: Mark many Gitlab jobs to be run manually
freedesktop.org Gitlab doesn't currently have enough test runners
available to run all of this every time. For higher-risk changes
(for example those that change the build system) we can run the
complete set through the web UI.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit a2f416c289)
2018-10-04 18:47:43 +01:00
Simon McVittie
f4ce779c46 ci: Reshuffle mingw jobs so we test different combinations
We test the combinations that we don't test on Travis-CI.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit a6d926b805)
2018-10-04 18:47:42 +01:00
Simon McVittie
c5d71a1889 ci: Use ccache to speed up repeated builds
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit d0728fd06e)
2018-10-04 16:58:13 +01:00
Simon McVittie
5c204a9ee5 ci: Add Gitlab-CI configuration
This uses the same shell scripts as Travis-CI, with slightly different
settings. We use Docker containers for all our Gitlab-CI runs, so take
the opportunity to use Debian 9 'stretch' as our baseline, and
relegate Ubuntu 14.04 'trusty' to to a secondary build.

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 60933c09e9)
2018-10-04 16:54:10 +01:00
Simon McVittie
6995c5ea5b ci: Explicitly install cmake
Travis-CI workers have cmake preinstalled, but Gitlab-CI Docker images
typically don't.

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 907832e008)
2018-10-04 16:54:10 +01:00
Simon McVittie
35fb20a1f4 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)
2018-10-04 16:54:10 +01:00
Ralf Habacker
900daf5ee4 travis-ci: Add cross building support for mingw 64 bit compiler
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105662
(cherry picked from commit d22e7901b5)
2018-10-04 16:54:10 +01:00
Ralf Habacker
316ad76a88 sysdeps-win: Print word-size-dependent offset correctly
AddrPC.Offset is the same size as a pointer, but previously
we printed it as though it was the same size as a long,
which is 32 bits on 64-bit Windows.

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105662
(cherry picked from commit 577813cf3a)
2018-10-04 16:54:10 +01:00
Ralf Habacker
cface8bb16 dbus-transport-socket: Correctly print DBusSocket with DBUS_SOCKET_FORMAT
Previously, on 64-bit Windows we were passing a 32-bit int where the
format string expects a 64-bit SOCKET.

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105662
(cherry picked from commit 18d4ff6644)
2018-10-04 11:19:21 +01:00
Simon McVittie
ece958ce9c Update NEWS 2018-08-30 17:35:36 +01:00
Simon McVittie
ddc6aa8b48 Reference the freedesktop.org Code of Conduct
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-08-30 17:35:08 +01:00
Simon McVittie
ed9719dbe3 Update NEWS 2018-08-30 17:34:45 +01:00
Simon McVittie
4a0867a8fc Do not apply __attribute__((__malloc__)) to dbus_realloc()
As noted in GLib commit c879f50f, gcc's interpretation of the malloc
attribute has become more strict over time, which could result in
miscompilation. The new definition is that in addition to assuming
that the returned memory block is newly-allocated, gcc now assumes
that it does not contain any valid pointers. This is OK for
uninitialized or zero-initialized memory returned by dbus_malloc()
or dbus_malloc0(), but not valid for dbus_realloc(), which might be
used for a dynamically-sized array of (structures containing)
valid pointers.

See https://gitlab.gnome.org/GNOME/glib/issues/1465

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107741
2018-08-30 17:34:25 +01:00
Simon McVittie
28450e7807 Update NEWS 2018-08-30 16:27:46 +01:00
Simon McVittie
7d4b00a79a server-unix: Don't leak address of systemd server on success
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107320
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
(cherry picked from commit d98c43c697)
2018-08-29 19:04:13 +01:00
Simon McVittie
f17c768de0 bus: Free address (from --address) when we have finished using it
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107320
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
(cherry picked from commit 7ae750c4e8)
2018-08-29 19:04:08 +01:00
Simon McVittie
ee14b13dd3 1.12.11 2018-08-03 01:05:33 +01:00
Simon McVittie
f98e784bb6 1.12.10 2018-08-02 19:34:17 +01:00
Simon McVittie
657ca7a915 Update NEWS 2018-08-02 19:24:00 +01:00
Simon McVittie
75914f3bff validate_body_helper: Bounds-check before validating booleans
Running the "embedded tests" through valgrind revealed that before this
commit, we would have been willing to read up to 3 bytes off the end of
a message if the message is truncated part way through a boolean. Any
practical allocator will round up allocations to the next 32-bit (or
larger) boundary, so in practice this will not leave the memory buffer
(and in particular did not crash during unit testing), but it could read
uninitialized contents.

On little-endian CPUs, an attacker might be able to use this to learn
whether up to 3 bytes of uninitialized memory in the dbus-daemon
were all-zero (their crafted message would be relayed) or not (their
connection would be disconnected for sending an invalid message). On
big-endian CPUs, an attacker might be able to use this to learn whether
up to 3 bytes were all-zeroes (relayed to a cooperating peer), 0-2
bytes of all-zeroes followed by 0x01 (relayed to a cooperating peer),
or something else (disconnected). This is not believed to be exploitable
to leak interesting information.

Fixes: 62e46533 "hardcode dbus_bool_t to 32 bits"
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107332
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Thiago Macieira <thiago@kde.org>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
(cherry picked from commit e93a775e68)
2018-08-02 19:21:35 +01:00
Simon McVittie
130ac24654 Update NEWS 2018-08-02 18:45:51 +01:00
Simon McVittie
5ccd36cecb nonce: Don't try to rmdir(NULL) on OOM
If re-initializing the string fails, it will be left in a state
where it has a length of 0 and a NULL buffer. That's valid to
"free", but not valid to pass to rmdir().

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107194
(cherry picked from commit 294e8b0b67)
2018-08-02 17:16:04 +01:00
Simon McVittie
9cf2d308ce dbus_server_listen: Don't leak first_connect_error
If an implementation fails to listen, and a subsequent implementation
succeeds, then we would have leaked this. Detected by running
tests/loopback.c under valgrind.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107194
(cherry picked from commit b14a4517a8)
2018-08-02 17:13:02 +01:00
Simon McVittie
4937a36c31 sysdeps: Reassure gcc 8 that we are not overflowing struct sockaddr_un
Using strncpy (buffer, str, strlen (str)) is a "code smell" that
might indicate a serious bug (it effectively turns strncpy into
strcpy), and gcc 8 now warns about it. In fact we avoided the bug
here, but it wasn't at all obvious.

We already checked that path_len is less than or equal to
_DBUS_MAX_SUN_PATH_LENGTH, which is 99, chosen to be strictly less
than the POSIX minimum sizeof(sun_path) >= 100, so we couldn't
actually be overflowing the available buffer.

The new static assertion in this commit matches a comment above the
definition of _DBUS_MAX_SUN_PATH_LENGTH: we define
_DBUS_MAX_SUN_PATH_LENGTH to 99, because POSIX says struct
sockaddr_un's sun_path member is at least 100 bytes (including space
for a \0 terminator). dbus will now fail to compile on
platforms that are non-POSIX-compliant in this way, except for Windows.

We zeroed the struct sockaddr_un before writing into it, so stopping
one byte short of the end of sun_path ensures that we get \0
termination.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107350
Reviewed-by: Thiago Macieira <thiago@kde.org>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
(cherry picked from commit f429631365)
2018-08-02 17:13:02 +01:00
Simon McVittie
ab8ef4ae31 build: Disable new gcc 8 warning -Wcast-function-type
The foreach(list, (DBusForeachFunction) free, NULL) idiom seems too
entrenched to remove it from stable branches.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107349
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Thiago Macieira <thiago@kde.org>
2018-08-02 17:12:26 +01:00
Simon McVittie
7469b878d5 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-06-04 17:56:44 +01:00
Simon McVittie
42772170a9 test: Skip TCP tests if getaddrinfo doesn't work
For example, this can be the case in bubblewrap or Debian pbuilder after
unsharing the network namespace:

    bwrap \
    --bind / / \
    --dev-bind /dev /dev \
    --bind /dev/shm /dev/shm \
    --bind /dev/pts /dev/pts \
    --unshare-net \
    ${builddir}/test/test-loopback --tap
    ...
    ok 1 /connect/tcp # SKIP Name resolution does not work here:
    getaddrinfo("127.0.0.1", "0", {flags=ADDRCONFIG, family=INET,
    socktype=STREAM, protocol=TCP}): Name or service not known

On some systems this can be circumvented by using nss_wrapper from
<https://cwrap.org/nss_wrapper.html>:

    cat > hosts <<EOF
    127.0.0.1 localhost
    EOF
    bwrap \
    ... \
    env \
    LD_PRELOAD=libnss_wrapper.so \
    NSS_WRAPPER_HOSTS=$(pwd)/hosts \
    ${builddir}/test/test-loopback --tap
    ...
    # listening at tcp:host=127.0.0.1,port=39219,family=ipv4,guid=...

but for systems where that does't work, we should be prepared to skip
the affected tests.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106812
(cherry picked from commit f1faafd59b)
2018-06-04 17:56:31 +01:00
Simon McVittie
44027e9ec6 server-oom test: Don't assume localhost is resolvable
Pathological autobuilder environments might not list localhost in
/etc/hosts.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106812
(cherry picked from commit 4cfc7de30d)
2018-06-04 17:56:04 +01:00
Simon McVittie
d0837e911d test: Test the same things with unix: that we do with tcp:
Minimal autobuilder environments don't always have working TCP,
so we may need to skip TCP tests. Make sure we test the equivalent
code paths via Unix sockets in those environments.

One notable exception is test/fdpass.c, which uses TCP as a transport
that is known not to be able to carry Unix fds; this needs to continue
to use TCP.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106812
(cherry picked from commit cb7dd5bfcc)
2018-06-04 17:56:04 +01:00
Simon McVittie
102129f86a server-oom test: Parse the address instead of going directly to TCP
This expands test coverage, and lets us reuse the test for other
address schemes.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106812
(cherry picked from commit b19c9e2f26)
2018-06-04 17:55:58 +01:00
Simon McVittie
8ec0b5ae2d sysdeps-unix: Handle errors from getaddrinfo correctly
getaddrinfo and getnameinfo have their own error-handling convention
in which the library call returns either 0 or an EAI_* error code
unrelated to errno. If the error code is not EAI_SYSTEM, then
the value of errno is undefined (in particular it might be carried
over from a previous system call or library call). Introduce a
new helper function _dbus_error_from_gai() to handle this.

The equivalent code paths in Windows appear to be OK: the Windows
implementation of getaddrinfo() is documented to return a Winsock
error code, which we seem to be handling correctly.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106395
(cherry picked from commit 60cedd0cfd)
2018-06-04 17:55:21 +01:00
Simon McVittie
6c3e82af25 Start 1.12.10 development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-04-30 18:38:55 +01:00
Simon McVittie
f8902fa1c8 1.12.8 2018-04-30 13:54:22 +01:00
Simon McVittie
08e48ca660 build: Uninstall JavaScript and CSS from htmldir
Otherwise, distcheck fails when mallard-ducktype is available.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 9391d769ae)
2018-04-27 18:18:24 +01:00
Simon McVittie
89526d300c Preallocate release name 2018-04-25 16:58:53 +01:00
Simon McVittie
9f76c4cbee NEWS: Mention non-local TCP too
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 2390a325a0)
2018-04-25 16:49:51 +01:00
Simon McVittie
e1e191f4a6 Update NEWS
(cherry picked from commit ee0e42ae2d)
2018-04-25 16:49:51 +01:00