platform/upstream/systemd.git
6 years agomeson: update bug reference
Zbigniew Jędrzejewski-Szmek [Tue, 24 Jul 2018 13:04:28 +0000 (15:04 +0200)]
meson: update bug reference

https://github.com/mesonbuild/meson/issues/1644 was resolved in 0.42:
https://github.com/mesonbuild/meson/pull/2191/commits/be4428005dff8b17af5696c8f05567de9af1a8c5,
but still no-go.

6 years agomeson: remove old comment
Zbigniew Jędrzejewski-Szmek [Tue, 24 Jul 2018 12:49:22 +0000 (14:49 +0200)]
meson: remove old comment

The linked page is gone, and I can't quite remember what the
warning was about. Something about recursive copying... Everything
seems to work.

6 years agomeson: drop workaround
Zbigniew Jędrzejewski-Szmek [Tue, 24 Jul 2018 12:39:14 +0000 (14:39 +0200)]
meson: drop workaround

It was added way back, and seems to work fine now without it.

6 years agomeson: include more build settings in status output
Lennart Poettering [Fri, 5 Oct 2018 14:38:42 +0000 (16:38 +0200)]
meson: include more build settings in status output

6 years agopath-util: fix path_simplify() with kill_dots and "."
Thomas Haller [Fri, 5 Oct 2018 11:14:38 +0000 (13:14 +0200)]
path-util: fix path_simplify() with kill_dots and "."

Previously, together with kill_dots true, patch like
".", "./.", ".//.//" would all return an empty string.

That is wrong. There must be one "." left to reference
the current directory.

Also, the comment with examples was wrong.

6 years agocore/dbus-execute: fix parsing CPUScheduling* and Nice for transient services
Yu Watanabe [Fri, 5 Oct 2018 14:43:08 +0000 (23:43 +0900)]
core/dbus-execute: fix parsing CPUScheduling* and Nice for transient services

Fixes #10290.

6 years ago * hack around deficiencies in prctl() PR_SET_MM_*
Frank Schaefer [Thu, 4 Oct 2018 21:06:16 +0000 (16:06 -0500)]
 * hack around deficiencies in prctl() PR_SET_MM_*

6 years agoMerge pull request #10134 from keszybz/test-runner
Lennart Poettering [Fri, 5 Oct 2018 18:35:30 +0000 (20:35 +0200)]
Merge pull request #10134 from keszybz/test-runner

Some test-related fixed and a test runner for installed tests

6 years agoman: fix explanation about UID/GID field in tmpfiles.d(5)
Yu Watanabe [Fri, 5 Oct 2018 09:33:40 +0000 (18:33 +0900)]
man: fix explanation about UID/GID field in tmpfiles.d(5)

Fixes #9495.

6 years agoMerge pull request #10117 from keszybz/undynamicify
Lennart Poettering [Fri, 5 Oct 2018 15:41:56 +0000 (17:41 +0200)]
Merge pull request #10117 from keszybz/undynamicify

Set DynamicUser=no for networkd, resolved, timesyncd

6 years agoman/systemd.exec: MountFlags=shared behaviour was changed (fixed?)
Alan Jenkins [Fri, 14 Sep 2018 10:57:57 +0000 (11:57 +0100)]
man/systemd.exec: MountFlags=shared behaviour was changed (fixed?)

The behaviour described *was* observed on Fedora 28
(systemd-238-9.git0e0aa59), with and without SELinux.  I don't actually
know why though!  It contradicts my understanding of the code, including an
explicit comment in the code.

Testing in a VM upgraded to v239-792-g1327f272d, this behaviour goes away.

Test case:

# /etc/systemd/system/mount-test.service
[Service]
MountFlags=shared
Type=oneshot
ExecStart=/usr/bin/ls -l /proc/1/ns/mnt /proc/self/ns/mnt
ExecStart=/usr/bin/grep ext4 /proc/self/mountinfo

Weird old behaviour: new mount namespace but / is fully shared.

lrwxrwxrwx. 1 root root 0 Sep 14 11:18 /proc/1/ns/mnt -> mnt:[4026531840]
lrwxrwxrwx. 1 root root 0 Sep 14 11:48 /proc/self/ns/mnt ->
mnt:[4026532851]

968 967 253:0 / / rw,relatime shared:1 - ext4 /dev/mapper/alan_dell_2016...

Current behaviour: / is not fully shared

lrwxrwxrwx. 1 root root 0 Sep 14 11:39 /proc/1/ns/mnt -> mnt:[4026531840]
lrwxrwxrwx. 1 root root 0 Sep 14 11:41 /proc/self/ns/mnt ->
mnt:[4026532329]

591 558 8:3 / / rw,relatime shared:313 master:1 - ext4 /dev/sda3 rw,secl...

6 years agoMerge pull request #10094 from keszybz/wants-loading
Lennart Poettering [Fri, 5 Oct 2018 15:36:31 +0000 (17:36 +0200)]
Merge pull request #10094 from keszybz/wants-loading

Fix bogus fragment paths in units in .wants/.requires

6 years agoMerge pull request #10152 from yuwata/udev-use-extract
Lennart Poettering [Fri, 5 Oct 2018 15:11:43 +0000 (17:11 +0200)]
Merge pull request #10152 from yuwata/udev-use-extract

udev: small cleanups

6 years agonetworkd-link: Don't start a DHCPv6 informational exchange automatically
Patrik Flykt [Tue, 2 Oct 2018 18:48:22 +0000 (12:48 -0600)]
networkd-link: Don't start a DHCPv6 informational exchange automatically

When a link is configured, wait until there is a Router Advertisement before
attempting to start DHCPv6. The intended DHCPv6 mode will be evaluated in
ndisc_router_handler() in networkd-ndisc.c.

6 years agotest-execute: add a test for systemcall filter (#10273)
Yu Watanabe [Fri, 5 Oct 2018 05:46:30 +0000 (14:46 +0900)]
test-execute: add a test for systemcall filter (#10273)

This adds a test for issue #9939 which is fixed by
a5404992cc7724ebf7572a0aa89d9fdb26ce0b62 (#9942).

6 years agodhcp6: don't include internal header "sparse-endian.h" in "sd-dhcp6-client.h"
Thomas Haller [Thu, 4 Oct 2018 16:54:58 +0000 (18:54 +0200)]
dhcp6: don't include internal header "sparse-endian.h" in "sd-dhcp6-client.h"

Arguably, libsystemd-network is (still) entirely internal API.
However there is the aim of maybe exposing it as public API.
For that reason, it cannot include internal headers from
"src/basic/".

Note how files "src/systemd/sd-*.h" don't include any systemd
headers which don't themself have an "sd-" prefix.

Fixes: d89a400ed664e0b57fd8667db5637792a185e831

6 years agoAdd DOCUMENTATION_URL as a standard value for /etc/os-release
Stephen Gallagher [Thu, 4 Oct 2018 12:19:18 +0000 (07:19 -0500)]
Add DOCUMENTATION_URL as a standard value for /etc/os-release

It is very useful for distributions to be able to set a primary
documentation URL in a standard location so that users and
applications on the system can identify it. For example, many
headless systems these days use the "Cockpit" admin console. It
would be ideal if we could specify this location directly in the
os-release file so that any application or service could have a
well-known location for retrieving this and displaying it
appropriately. Users could likewise examine /etc/os-release to
learn this location.

Related: https://github.com/cockpit-project/cockpit/issues/10198

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
6 years agoMerge pull request #10263 from keszybz/test-fs-util-generalization
Lennart Poettering [Thu, 4 Oct 2018 11:23:41 +0000 (13:23 +0200)]
Merge pull request #10263 from keszybz/test-fs-util-generalization

test-fs-util generalization

6 years agotest: fix memleak in test-fs-util
Yu Watanabe [Thu, 4 Oct 2018 07:22:11 +0000 (16:22 +0900)]
test: fix memleak in test-fs-util

Fixes #10267 and CID#1395997.

6 years agotest-fs-util: run all tests on the specified directory
Zbigniew Jędrzejewski-Szmek [Wed, 3 Oct 2018 12:08:49 +0000 (14:08 +0200)]
test-fs-util: run all tests on the specified directory

This removes $RENAME_NOREPLACE_DIR and uses a command-line argument instead.
Logging is added, and tests are skipped if we get -EPERM or friends
(which happens on FAT and other filesystems).

6 years agotest-fs-util: simplify testdir creation
Zbigniew Jędrzejewski-Szmek [Wed, 3 Oct 2018 11:42:08 +0000 (13:42 +0200)]
test-fs-util: simplify testdir creation

6 years agoMerge pull request #10251 from poettering/renameat-racy
Zbigniew Jędrzejewski-Szmek [Wed, 3 Oct 2018 11:37:53 +0000 (13:37 +0200)]
Merge pull request #10251 from poettering/renameat-racy

rename_noreplace() fallback for file systems where neither RENAME_REPLACE nor link()/unlinkat() is available

6 years agoMerge pull request #10257 from pfl/dhcp6_pd_enable_later_link
Zbigniew Jędrzejewski-Szmek [Wed, 3 Oct 2018 09:04:41 +0000 (11:04 +0200)]
Merge pull request #10257 from pfl/dhcp6_pd_enable_later_link

DHCP6 PD enable later link

6 years agoMerge pull request #10261 from yuwata/test-network
Zbigniew Jędrzejewski-Szmek [Wed, 3 Oct 2018 08:03:34 +0000 (10:03 +0200)]
Merge pull request #10261 from yuwata/test-network

test: small improvements for systemd-networkd-test.py

6 years agotest-execute: also tests under the condition that unshare() is filtered
Yu Watanabe [Wed, 19 Sep 2018 05:17:29 +0000 (14:17 +0900)]
test-execute: also tests under the condition that unshare() is filtered

This is mainly for testing 1beab8b0d0ff2d7d1436b52d4a0c3d56dc908962.

6 years agoMerge pull request #10213 from yuwata/oss-fuzz-10746
Zbigniew Jędrzejewski-Szmek [Wed, 3 Oct 2018 06:31:55 +0000 (08:31 +0200)]
Merge pull request #10213 from yuwata/oss-fuzz-10746

dhcp6: fix issue oss-fuzz#10746

6 years agotest: make systemd-networkd-tests.py run on arbitrary directory
Yu Watanabe [Wed, 3 Oct 2018 05:38:30 +0000 (14:38 +0900)]
test: make systemd-networkd-tests.py run on arbitrary directory

6 years agotest: replace stop+start by restart
Yu Watanabe [Wed, 3 Oct 2018 05:16:24 +0000 (14:16 +0900)]
test: replace stop+start by restart

This suppress the following warnings:
```
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
```

6 years agotest: add a testcase for oss-fuzz#10746
Yu Watanabe [Sun, 30 Sep 2018 11:28:19 +0000 (20:28 +0900)]
test: add a testcase for oss-fuzz#10746

6 years agodhcp6: check option length before reading values
Yu Watanabe [Sun, 30 Sep 2018 11:23:58 +0000 (20:23 +0900)]
dhcp6: check option length before reading values

Fixes oss-fuzz#10746
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10746.

6 years agotest: add test for sd_device
Yu Watanabe [Fri, 28 Sep 2018 11:52:48 +0000 (20:52 +0900)]
test: add test for sd_device

6 years agoudev: Allow acpi_index and index to be "0"
Joe Hershberger [Fri, 28 Sep 2018 20:32:35 +0000 (15:32 -0500)]
udev: Allow acpi_index and index to be "0"

0 can be a valid index returned by the BIOS, so allow that by using the
parsing function safe_atolu() to check for errors without excluding the
valid value "0".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonetworkd-dhcp6: Request prefix delegation for a new link
Patrik Flykt [Tue, 2 Oct 2018 18:29:09 +0000 (12:29 -0600)]
networkd-dhcp6: Request prefix delegation for a new link

Request prefix delegation for a new downstream link that is enabled
after any number of upstream DHCPv6 links. Submit the request after
the link has been configured with a link-local address.

If the upstream DHCPv6 client has already been configured to request
prefixes, attempt to re-assign any possible prefixes between the
already existing links and the new one. If no prefixes are yet
acquired, nothing will happen right away and any prefixes will be
distributed after a reply from the DHCPv6 server.

If none of the already existing downstream links have requested
DHCPv6 prefixes to be assigned, enable prefix delegation for each
client and restart them one by one if they are already running. This
causes the DHCPv6 clients to re-acquire addresses and prefixes and
to re-distribute them to all links when receiving an updated
response from their respective DHCPv6 servers. If the DHCPv6 client
in question was not already running, it is set to request prefixes
but not restarted.

When an error occurs while setting or restarting the DHCPv6 client,
log the incident and move over to the next link.

Fixes #9758.

6 years agonetworkd-dhcp: Rename function and reduce its logging
Patrik Flykt [Tue, 2 Oct 2018 18:29:06 +0000 (12:29 -0600)]
networkd-dhcp: Rename function and reduce its logging

Rename dhcp6_verify_link() to dhcp6_get_prefix_delegation() in order
to be clearer in what it does. Reduce unnecessary logging.

6 years agoDocs: Update CoC with email alias for David Strauss
David Strauss [Tue, 2 Oct 2018 16:22:45 +0000 (09:22 -0700)]
Docs: Update CoC with email alias for David Strauss

6 years agoupdate TODO
Lennart Poettering [Tue, 2 Oct 2018 16:00:10 +0000 (18:00 +0200)]
update TODO

6 years agoMerge pull request #10252 from poettering/recv-log-msg-bump
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 15:56:31 +0000 (17:56 +0200)]
Merge pull request #10252 from poettering/recv-log-msg-bump

tiny sd-ravd/sd-ndisc logging fixes

6 years agoMerge pull request #10255 from poettering/hide-new-id128
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 15:54:36 +0000 (17:54 +0200)]
Merge pull request #10255 from poettering/hide-new-id128

drop references to "journalctl --new-id128"

6 years agoMerge pull request #9898 from keszybz/id128
Lennart Poettering [Tue, 2 Oct 2018 15:43:37 +0000 (17:43 +0200)]
Merge pull request #9898 from keszybz/id128

Add a new tool 'systemd-id128'

6 years agoMerge pull request #10249 from keszybz/lgtm-fixes
Lennart Poettering [Tue, 2 Oct 2018 15:42:55 +0000 (17:42 +0200)]
Merge pull request #10249 from keszybz/lgtm-fixes

Fixes for issues found by LGTM

6 years agotree-wide: drop all references to "journalctl --new-id128"
Lennart Poettering [Tue, 2 Oct 2018 14:43:54 +0000 (16:43 +0200)]
tree-wide: drop all references to "journalctl --new-id128"

Let's advertise "systemd-id128 new" instead.

6 years agojournalctl: drop --new-id128 from help and man texts
Lennart Poettering [Tue, 2 Oct 2018 14:42:30 +0000 (16:42 +0200)]
journalctl: drop --new-id128 from help and man texts

Let's remove redundancy and not advertise "journalctl --new-id128"
anymore, now that we have "systemd-id128 new" in a proper tool.

This allows us to reduce the overly large journalctl command set a bit.

Note that this just removes the --help and man text, the call remains
available for compat reasons.

6 years agoupdate TODO
Lennart Poettering [Tue, 2 Oct 2018 14:28:06 +0000 (16:28 +0200)]
update TODO

6 years agosd-radv: EAGAIN is not really unexpected, distinguishit from other errors when logging
Lennart Poettering [Tue, 2 Oct 2018 14:26:50 +0000 (16:26 +0200)]
sd-radv: EAGAIN is not really unexpected, distinguishit from other errors when logging

6 years agosd-ndisc: generate debug log messages on unexpected errors
Lennart Poettering [Tue, 2 Oct 2018 14:25:51 +0000 (16:25 +0200)]
sd-ndisc: generate debug log messages on unexpected errors

We really should make it possible to debug unexpected errors, hence log
something at LOG_DEBUG.

6 years agosd-radv: remove log_radv_warning_errno()
Lennart Poettering [Tue, 2 Oct 2018 14:22:54 +0000 (16:22 +0200)]
sd-radv: remove log_radv_warning_errno()

According to our CODING_STYLE our library code should generally not log
beyond LOG_DEBUG. Let's hence get rid of log_radv_warning_errno() and
just use log_radv_errno() instead.

6 years agotest: add test case for rename_noreplace()
Lennart Poettering [Tue, 2 Oct 2018 14:10:39 +0000 (16:10 +0200)]
test: add test case for rename_noreplace()

6 years agofs-util: add racy RENAME_NOREPLACE fallback using access()
Lennart Poettering [Tue, 2 Oct 2018 11:34:18 +0000 (13:34 +0200)]
fs-util: add racy RENAME_NOREPLACE fallback using access()

Apparently FAT on some recent kernels can't do RENAME_NOREPLACE, and of
course cannot do linkat()/unlinkat() either (as the hard link concept
does not exist on FAT). Add a fallback using an explicit beforehand
faccessat() check. This sucks, but what we can do if the safe operations
are not available?

Fixes: #10063

6 years agofileio: fix error propagation in link_tmpfile()
Lennart Poettering [Tue, 2 Oct 2018 11:34:05 +0000 (13:34 +0200)]
fileio: fix error propagation in link_tmpfile()

6 years agobus-unit-util: fix parsing of IPAddress{Allow,Deny}
Ronny Chevalier [Fri, 21 Sep 2018 13:59:25 +0000 (14:59 +0100)]
bus-unit-util: fix parsing of IPAddress{Allow,Deny}

While the config parser correctly handles the case of multiple IPs,
bus_append_cgroup_property was only parsing one IP,
and it would fail with "Failed to parse IP address prefix" when given
a list of IPs.

6 years agoMerge pull request #10246 from keszybz/fuzz-buss
Lennart Poettering [Tue, 2 Oct 2018 13:45:21 +0000 (15:45 +0200)]
Merge pull request #10246 from keszybz/fuzz-buss

Bus fuzzer

6 years agojournal-upload: add asserts that snprintf does not return an error
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 10:46:31 +0000 (12:46 +0200)]
journal-upload: add asserts that snprintf does not return an error

LGMT complains:
> The size argument of this snprintf call is derived from its return value,
> which may exceed the size of the buffer and overflow.

Let's make sure that r is non-negative. (This shouldn't occur unless the format
string is borked, so let's just add an assert.)
Then, let's reorder the comparison to avoid the potential overflow.

6 years agopid1: remove unnecessary error reassignment
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 10:35:37 +0000 (12:35 +0200)]
pid1: remove unnecessary error reassignment

LGTM was complaining:
> Comparison is always true because r >= 0.

6 years agoshared/install: avoid overwriting 'r' counter with a partial result
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 10:31:13 +0000 (12:31 +0200)]
shared/install: avoid overwriting 'r' counter with a partial result

We want to store either the first error or the total number of changes in 'r'.
Instead, we were overwriting this with the return value from
install_info_traverse().

LGTM complained later in the loop that:
> Comparison is always true because r >= 0.

6 years agoPrettify printing of uuids
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 13:02:04 +0000 (15:02 +0200)]
Prettify printing of uuids

I know this a bit over the top, but I'm following reviewers' requests.

6 years agoman: add man page for systemd-id128
Zbigniew Jędrzejewski-Szmek [Tue, 21 Aug 2018 14:25:21 +0000 (16:25 +0200)]
man: add man page for systemd-id128

6 years agosystemd-id128: a new tool to print machine/boot/invocation/app-specific ids
Zbigniew Jędrzejewski-Szmek [Tue, 21 Aug 2018 14:08:48 +0000 (16:08 +0200)]
systemd-id128: a new tool to print machine/boot/invocation/app-specific ids

The raison d'etre for this program is printing machine-app-specific IDs. We
provide a library function for that, but not a convenient API. We can hardly
ask people to quickly hack their own C programs or call libsystemd through CFFI
in python or another scripting language if they just want to print an ID.

Verb 'new' was already available as 'journalctl --new-id128', but this makes
it more discoverable.

v2:
- rename binary to systemd-id128
- make --app-specific= into a switch that applies to boot-id and machine-id

6 years agosd-id128: add sd_id128_get_boot_app_specific()
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 12:25:24 +0000 (14:25 +0200)]
sd-id128: add sd_id128_get_boot_app_specific()

6 years agojournalctl: move generate_new_id128() to shared
Zbigniew Jędrzejewski-Szmek [Tue, 21 Aug 2018 13:38:04 +0000 (15:38 +0200)]
journalctl: move generate_new_id128() to shared

6 years agoicmp6-util: stop ignoring EAGAIN and EINTR in icmp6_receive
Evgeny Vereshchagin [Mon, 1 Oct 2018 22:37:17 +0000 (22:37 +0000)]
icmp6-util: stop ignoring EAGAIN and EINTR in icmp6_receive

The code handling the errors was originally part of ndisc_recv, which,
being an event handler, would be simply turned off if it returned a negative
error code. It's no longer necessary. Plus, it helps avoid passing
an uninitialized value to radv_send.

Closes https://github.com/systemd/systemd/issues/10223.

6 years agojournal-verify: add comment and silence LGTM warning
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 10:26:23 +0000 (12:26 +0200)]
journal-verify: add comment and silence LGTM warning

6 years agoboot: change multiplication order
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 10:17:21 +0000 (12:17 +0200)]
boot: change multiplication order

LGTM was complaining:
> Multiplication result may overflow 'unsigned int' before it is converted to 'unsigned long'.

6 years agobasic/hexdecoct: check for overflow
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 10:15:22 +0000 (12:15 +0200)]
basic/hexdecoct: check for overflow

LGTM was complaining:
> Multiplication result may overflow 'int' before it is converted to 'long'.
Fix this by changing all types to ssize_t and add a check for overflow
while at it.

6 years agobus-message: avoid wrap-around when using length read from message
Zbigniew Jędrzejewski-Szmek [Thu, 23 Aug 2018 12:48:40 +0000 (14:48 +0200)]
bus-message: avoid wrap-around when using length read from message

We would read (-1), and then add 1 to it, call message_peek_body(..., 0, ...),
and when trying to make use of the data.

The fuzzer test case is just for one site, but they all look similar.

v2: fix two UINT8_MAX/UINT32_MAX mismatches founds by LGTM

6 years agobus-message: return -EBADMSG not -EINVAL on invalid !gvariant messages
Zbigniew Jędrzejewski-Szmek [Sat, 11 Aug 2018 09:43:09 +0000 (11:43 +0200)]
bus-message: return -EBADMSG not -EINVAL on invalid !gvariant messages

6 years agofuzz-bus-message: add two test cases that pass now
Zbigniew Jędrzejewski-Szmek [Sat, 11 Aug 2018 09:31:45 +0000 (11:31 +0200)]
fuzz-bus-message: add two test cases that pass now

It seems that they got fixed by one of the patches. Let's add them
just in case.

6 years agobus-message: also properly copy struct signature when skipping
Zbigniew Jędrzejewski-Szmek [Sat, 11 Aug 2018 07:02:48 +0000 (09:02 +0200)]
bus-message: also properly copy struct signature when skipping

The change is similar to that in the previous commit, but I don't have
a reproducer / test case case for this one, so I'm keeping it seperate.

6 years agobus-message: fix skipping of array fields in !gvariant messages
Zbigniew Jędrzejewski-Szmek [Sat, 11 Aug 2018 06:32:20 +0000 (08:32 +0200)]
bus-message: fix skipping of array fields in !gvariant messages

We copied part of the string into a buffer that was off by two.
If the element signature had length one, we'd copy 0 bytes and crash when
looking at the "first" byte. Otherwise, we would crash because strncpy would
not terminate the string.

6 years agobus-message: output debug information about offset troubles
Zbigniew Jędrzejewski-Szmek [Fri, 3 Aug 2018 16:05:27 +0000 (18:05 +0200)]
bus-message: output debug information about offset troubles

6 years agotest-bus-gvariant: turn on debug output
Zbigniew Jędrzejewski-Szmek [Fri, 3 Aug 2018 16:04:02 +0000 (18:04 +0200)]
test-bus-gvariant: turn on debug output

I thought the test was wrong, but it turns out one of my patches was at
fault. But this helps to diagnose issues.

6 years agobus-message: drop asserts in functions which are wrappers for varargs version
Zbigniew Jędrzejewski-Szmek [Fri, 3 Aug 2018 14:36:51 +0000 (16:36 +0200)]
bus-message: drop asserts in functions which are wrappers for varargs version

The function does no processing on it's own, and just forwards arguments
to the other function. Let's just use the asserts there.

6 years agobus-message: fix calculation of offsets table for arrays
Zbigniew Jędrzejewski-Szmek [Fri, 3 Aug 2018 12:46:57 +0000 (14:46 +0200)]
bus-message: fix calculation of offsets table for arrays

This is similar to the grandparent commit 'fix calculation of offsets table',
except that now the change is for array elements. Same story as before: we need
to make sure that the offsets increase enough taking alignment into account.

While at it, rename 'p' to 'previous' to match similar code in other places.

6 years agobus-message: remove duplicate assignment
Zbigniew Jędrzejewski-Szmek [Thu, 2 Aug 2018 12:25:31 +0000 (14:25 +0200)]
bus-message: remove duplicate assignment

6 years agobus-message: fix calculation of offsets table
Zbigniew Jędrzejewski-Szmek [Thu, 2 Aug 2018 12:25:11 +0000 (14:25 +0200)]
bus-message: fix calculation of offsets table

The offsets specify the ends of variable length data. We would trust the
incoming data, putting the offsets specified in our message
into the offsets tables after doing some superficial verification.
But when actually reading the data we apply alignment, so we would take
the previous offset, align it, making it bigger then current offset, and
then we'd try to read data of negative length.

In the attached example, the message specifies the following offsets:
[1, 4]
but the alignment of those items is
[1, 8]
so we'd calculate the second item as starting at 8 and ending at 4.

6 years agobus: do not print (null) if the message has unknown type
Zbigniew Jędrzejewski-Szmek [Wed, 1 Aug 2018 22:46:20 +0000 (00:46 +0200)]
bus: do not print (null) if the message has unknown type

6 years agobus-message: use define
Zbigniew Jędrzejewski-Szmek [Tue, 24 Jul 2018 19:24:53 +0000 (21:24 +0200)]
bus-message: use define

6 years agobus-message: rename function for clarity
Zbigniew Jędrzejewski-Szmek [Tue, 24 Jul 2018 18:14:39 +0000 (20:14 +0200)]
bus-message: rename function for clarity

There's already message_free_last_container(), so rename to match.

6 years agobus-message: do not crash on message with a string of zero length
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 11:21:44 +0000 (13:21 +0200)]
bus-message: do not crash on message with a string of zero length

We'd calculate the "real" length of the string as 'item_size - 1', which does
not work out well when item_size == 0.

6 years agobus-message: let's always use -EBADMSG when the message is bad
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 09:12:33 +0000 (11:12 +0200)]
bus-message: let's always use -EBADMSG when the message is bad

-EINVAL means the arguments were somehow wrong, so translate the code we get
internally into -EBADMSG when returning.

6 years agobus-message: avoid an infinite loop on empty structures
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 08:52:51 +0000 (10:52 +0200)]
bus-message: avoid an infinite loop on empty structures

The alternative would be to treat gvariant and !gvariant messages differently.
But this is a problem because we check signatures is variuos places before we
have an actual message, for example in sd_bus_add_object_vtable(). It seems
better to treat things consistent (i.e. follow the lowest common denominator)
and disallow empty structures everywhere.

6 years agosd-bus: unify three code-paths which free struct bus_container
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 06:06:28 +0000 (08:06 +0200)]
sd-bus: unify three code-paths which free struct bus_container

We didn't free one of the fields in two of the places.

$ valgrind --show-leak-kinds=all --leak-check=full \
  build/fuzz-bus-message \
  test/fuzz/fuzz-bus-message/leak-c09c0e2256d43bc5e2d02748c8d8760e7bc25d20
...
==14457== HEAP SUMMARY:
==14457==     in use at exit: 3 bytes in 1 blocks
==14457==   total heap usage: 509 allocs, 508 frees, 51,016 bytes allocated
==14457==
==14457== 3 bytes in 1 blocks are definitely lost in loss record 1 of 1
==14457==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==14457==    by 0x53AFE79: strndup (in /usr/lib64/libc-2.27.so)
==14457==    by 0x4F52EB8: free_and_strndup (string-util.c:1039)
==14457==    by 0x4F8E1AB: sd_bus_message_peek_type (bus-message.c:4193)
==14457==    by 0x4F76CB5: bus_message_dump (bus-dump.c:144)
==14457==    by 0x108F12: LLVMFuzzerTestOneInput (fuzz-bus-message.c:24)
==14457==    by 0x1090F7: main (fuzz-main.c:34)
==14457==
==14457== LEAK SUMMARY:
==14457==    definitely lost: 3 bytes in 1 blocks

6 years agobus-message: use structured initialization to avoid use of unitialized memory
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 05:38:10 +0000 (07:38 +0200)]
bus-message: use structured initialization to avoid use of unitialized memory

As far as I can see, we would either reuse some values from a previously exited
container or just random bytes from the heap.

Should fix #10127.

6 years agoIntroduce free_and_strndup and use it in bus-message.c
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 05:03:01 +0000 (07:03 +0200)]
Introduce free_and_strndup and use it in bus-message.c

v2: fix error in free_and_strndup()

When the orignal and copied message were the same, but shorter than specified
length l, memory read past the end of the buffer would be performed. A test
case is included: a string that had an embedded NUL ("q\0") is used to replace
"q".

v3: Fix one more bug in free_and_strndup and add tests.

v4: Some style fixed based on review, one more use of free_and_replace, and
make the tests more comprehensive.

6 years agofuzz-bus-message: add fuzzer for message parsing
Zbigniew Jędrzejewski-Szmek [Sat, 7 Jul 2018 17:30:25 +0000 (19:30 +0200)]
fuzz-bus-message: add fuzzer for message parsing

As with other fuzzers, SYSTEMD_FUZZ_OUTPUT=1 and SYSTEMD_LOG_LEVEL=debug can be
used for debugging.

6 years agodocs: add a simple, auto-generated index.md
Lennart Poettering [Tue, 2 Oct 2018 07:53:05 +0000 (09:53 +0200)]
docs: add a simple, auto-generated index.md

This is useful for the github pages feature

6 years agoSet theme jekyll-theme-modernist
Lennart Poettering [Tue, 2 Oct 2018 08:07:38 +0000 (10:07 +0200)]
Set theme jekyll-theme-modernist

6 years agoSet theme jekyll-theme-tactile
Lennart Poettering [Tue, 2 Oct 2018 08:06:41 +0000 (10:06 +0200)]
Set theme jekyll-theme-tactile

6 years agoMerge pull request #10245 from keszybz/coc-file-rename
Lennart Poettering [Tue, 2 Oct 2018 07:57:09 +0000 (09:57 +0200)]
Merge pull request #10245 from keszybz/coc-file-rename

code-of-conduct file rename

6 years agotest: fix tests for supplementary groups
Yu Watanabe [Sat, 29 Sep 2018 12:05:52 +0000 (21:05 +0900)]
test: fix tests for supplementary groups

Fixes #9881.

6 years agomeson: treat all fuzz cases as unit tests
Zbigniew Jędrzejewski-Szmek [Fri, 10 Aug 2018 15:15:05 +0000 (17:15 +0200)]
meson: treat all fuzz cases as unit tests

318/365 fuzz-bus-message:crash-26bba7182dedc8848939931d9fcefcb7922f2e56:address  OK       0.03 s
319/365 fuzz-bus-message:crash-29ed3c202e0ffade3cad42c8bbeb6cc68a21eb8e:address  OK       0.03 s
320/365 fuzz-bus-message:crash-b88ad9ecf4aacf4a0caca5b5543953265367f084:address  OK       0.03 s
321/365 fuzz-bus-message:crash-c1b37b4729b42c0c05b23cba4eed5d8102498a1e:address  OK       0.03 s
322/365 fuzz-bus-message:crash-d8f3941c74219b4c03532c9b244d5ea539c61af5:address  OK       0.03 s
323/365 fuzz-bus-message:crash-e1b811da5ca494e494b77c6bd8e1c2f2989425c5:address  OK       0.03 s
324/365 fuzz-bus-message:leak-c09c0e2256d43bc5e2d02748c8d8760e7bc25d20:address  OK       0.04 s
325/365 fuzz-bus-message:message1:address       OK       0.03 s
326/365 fuzz-bus-message:timeout-08ee8f6446a4064db064e8e0b3d220147f7d0b5b:address  OK       0.03 s
327/365 fuzz-dhcp-server:discover-existing:address  OK       0.04 s
328/365 fuzz-dhcp-server:discover-new:address   OK       0.03 s
329/365 fuzz-dhcp-server:release:address        OK       0.04 s
330/365 fuzz-dhcp-server:request-existing:address  OK       0.03 s
331/365 fuzz-dhcp-server:request-new:address    OK       0.03 s
332/365 fuzz-dhcp-server:request-reboot:address  OK       0.03 s
333/365 fuzz-dhcp-server:request-renew:address  OK       0.03 s
334/365 fuzz-dns-packet:issue-7888:address      OK       0.03 s
335/365 fuzz-dns-packet:oss-fuzz-5465:address   OK       0.03 s
336/365 fuzz-journal-remote:crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76:address  OK       0.06 s
337/365 fuzz-journal-remote:crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45:address  OK       0.04 s
338/365 fuzz-journal-remote:invalid-ts.txt:address  OK       0.04 s
339/365 fuzz-journal-remote:oss-fuzz-8659:address  OK       0.06 s
340/365 fuzz-journal-remote:oss-fuzz-8686:address  OK       0.04 s
341/365 fuzz-journal-remote:sample.txt:address  OK       0.07 s
342/365 fuzz-unit-file:directives.service:address  OK       0.03 s
343/365 fuzz-unit-file:empty.scope:address      OK       0.04 s
344/365 fuzz-unit-file:machine.slice:address    OK       0.03 s
345/365 fuzz-unit-file:oss-fuzz-6884:address    OK       0.05 s
346/365 fuzz-unit-file:oss-fuzz-6885:address    OK       0.03 s
347/365 fuzz-unit-file:oss-fuzz-6886:address    OK       0.04 s
348/365 fuzz-unit-file:oss-fuzz-6892:address    OK       0.03 s
349/365 fuzz-unit-file:oss-fuzz-6897:address    OK       0.05 s
350/365 fuzz-unit-file:oss-fuzz-6897-evverx:address  OK       0.04 s
351/365 fuzz-unit-file:oss-fuzz-6908:address    OK       0.05 s
352/365 fuzz-unit-file:oss-fuzz-6917:address    OK       0.06 s
353/365 fuzz-unit-file:oss-fuzz-6977:address    OK       0.08 s
354/365 fuzz-unit-file:oss-fuzz-6977-unminimized:address  OK       0.10 s
355/365 fuzz-unit-file:oss-fuzz-7004:address    OK       0.03 s
356/365 fuzz-unit-file:oss-fuzz-8064:address    OK       0.03 s
357/365 fuzz-unit-file:oss-fuzz-8827:address    OK       0.50 s
358/365 fuzz-unit-file:proc-sys-fs-binfmt_misc.automount:address  OK       0.03 s
359/365 fuzz-unit-file:syslog.socket:address    OK       0.03 s
360/365 fuzz-unit-file:systemd-ask-password-console.path:address  OK       0.03 s
361/365 fuzz-unit-file:systemd-machined.service:address  OK       0.03 s
362/365 fuzz-unit-file:systemd-resolved.service:address  OK       0.03 s
363/365 fuzz-unit-file:systemd-tmpfiles-clean.timer:address  OK       0.03 s
364/365 fuzz-unit-file:timers.target:address    OK       0.03 s
365/365 fuzz-unit-file:var-lib-machines.mount:address  OK       0.04 s

This gives us slightly nicer coverage in the normal test run.

When in a git repo, git ls-files is used to get a list of files known to git.
This mirrors what update-man-rules does for man files. Only looking at files
known to git makes it easier to not forget to commit the test file to git,
and also makes bisecting easier if some files are left in repo.

When outside of a git repo, we expect to be unpacked from a tarball, so just
using all files reported by ls is OK.

6 years agomeson: use .source_root() in more places
Zbigniew Jędrzejewski-Szmek [Fri, 10 Aug 2018 14:50:07 +0000 (16:50 +0200)]
meson: use .source_root() in more places

In the main meson.build file, .source_root() and .current_source_dir() are
equivalent, but it seems more appropriate to use .source_root() when we are appending
a path which is by design relative to repo root.

6 years agomeson: add -Dlog-trace to set LOG_TRACE
Zbigniew Jędrzejewski-Szmek [Tue, 7 Aug 2018 15:34:47 +0000 (17:34 +0200)]
meson: add -Dlog-trace to set LOG_TRACE

The justification is the same as for -Dvalgrind: setting config in
meson in this way is easier, because when the value is changed stuff
that should be rebuilt is rebuilt.

6 years agomeson: drop duplicated condition
Zbigniew Jędrzejewski-Szmek [Tue, 7 Aug 2018 16:10:53 +0000 (18:10 +0200)]
meson: drop duplicated condition

The generic check suffices for those four.

6 years agotest-bus-marshal: use cescaping instead of hexmem
Zbigniew Jędrzejewski-Szmek [Sat, 7 Jul 2018 17:08:52 +0000 (19:08 +0200)]
test-bus-marshal: use cescaping instead of hexmem

It is easier to see the contents this way by eye.

6 years agofuzz: unify the "fuzz-regressions" directory with the main corpus
Zbigniew Jędrzejewski-Szmek [Sat, 7 Jul 2018 16:09:21 +0000 (18:09 +0200)]
fuzz: unify the "fuzz-regressions" directory with the main corpus

There isn't really much need to keep them separate. Anything which is a good
corpus entry can be used as a smoke test, and anything which which is a
regression test can just as well be inserted into the corpus.

The only functional difference from this patch (apart from different paths in
output) is that the regression tests are now zipped together with the rest of
the corpus.

$ meson configure build -Dslow-tests=true && ninja -C build test
...
307/325 fuzz-dns-packet:issue-7888:address      OK       0.06 s
308/325 fuzz-dns-packet:oss-fuzz-5465:address   OK       0.04 s
309/325 fuzz-journal-remote:crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76:address  OK       0.07 s
310/325 fuzz-journal-remote:crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45:address  OK       0.05 s
311/325 fuzz-journal-remote:oss-fuzz-8659:address  OK       0.05 s
312/325 fuzz-journal-remote:oss-fuzz-8686:address  OK       0.07 s
313/325 fuzz-unit-file:oss-fuzz-6884:address    OK       0.06 s
314/325 fuzz-unit-file:oss-fuzz-6885:address    OK       0.05 s
315/325 fuzz-unit-file:oss-fuzz-6886:address    OK       0.05 s
316/325 fuzz-unit-file:oss-fuzz-6892:address    OK       0.05 s
317/325 fuzz-unit-file:oss-fuzz-6897:address    OK       0.05 s
318/325 fuzz-unit-file:oss-fuzz-6897-evverx:address  OK       0.06 s
319/325 fuzz-unit-file:oss-fuzz-6908:address    OK       0.07 s
320/325 fuzz-unit-file:oss-fuzz-6917:address    OK       0.07 s
321/325 fuzz-unit-file:oss-fuzz-6977:address    OK       0.13 s
322/325 fuzz-unit-file:oss-fuzz-6977-unminimized:address  OK       0.12 s
323/325 fuzz-unit-file:oss-fuzz-7004:address    OK       0.05 s
324/325 fuzz-unit-file:oss-fuzz-8064:address    OK       0.05 s
325/325 fuzz-unit-file:oss-fuzz-8827:address    OK       0.52 s

6 years agofuzz: rename "fuzz-corpus" directory to just "fuzz"
Zbigniew Jędrzejewski-Szmek [Sat, 7 Jul 2018 15:43:40 +0000 (17:43 +0200)]
fuzz: rename "fuzz-corpus" directory to just "fuzz"

Also, all corpus subdirectories are named exactly the same as the fuzzer they
are for. This makes the paths a bit longer, but easier.

6 years agococ: spell systemd in the one-and-only correct way
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 07:34:01 +0000 (09:34 +0200)]
coc: spell systemd in the one-and-only correct way

6 years agococ: reword the sentence about individual contact
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 07:32:59 +0000 (09:32 +0200)]
coc: reword the sentence about individual contact

It wasn't clear enough:
https://github.com/systemd/systemd/pull/10233#discussion_r221734060

6 years agodocs: rename file to appease github
Zbigniew Jędrzejewski-Szmek [Tue, 2 Oct 2018 07:29:42 +0000 (09:29 +0200)]
docs: rename file to appease github

Hopefully this will be enough to let github notice that we have
a coc now and display the green checkmark:
https://github.com/systemd/systemd/pull/10233#issuecomment-425918447

6 years agopo: update Turkish translation
Muhammet Kara [Mon, 1 Oct 2018 17:24:27 +0000 (20:24 +0300)]
po: update Turkish translation