platform/upstream/systemd.git
5 years agobootspec: split out ESP blkid validation into function of its own
Lennart Poettering [Wed, 30 Jan 2019 17:24:59 +0000 (18:24 +0100)]
bootspec: split out ESP blkid validation into function of its own

This makes it easier to add an alternative implementation for this that
uses sd-device instead of blkid directly.

5 years agobootspec: add comment explaining verify_esp() return codes
Lennart Poettering [Tue, 29 Jan 2019 11:01:36 +0000 (12:01 +0100)]
bootspec: add comment explaining verify_esp() return codes

5 years agobootspec: use SYNTHETIC_ERRNO() where appropriate
Lennart Poettering [Mon, 28 Jan 2019 19:08:34 +0000 (20:08 +0100)]
bootspec: use SYNTHETIC_ERRNO() where appropriate

5 years agoboot-bless: port over to new $BOOT discovery calls
Lennart Poettering [Wed, 23 Jan 2019 16:05:15 +0000 (17:05 +0100)]
boot-bless: port over to new $BOOT discovery calls

5 years agobootctl: output where we found $BOOT
Lennart Poettering [Wed, 23 Jan 2019 15:59:28 +0000 (16:59 +0100)]
bootctl: output where we found $BOOT

5 years agobootctl: teach bootctl the new partition type
Lennart Poettering [Wed, 23 Jan 2019 15:18:29 +0000 (16:18 +0100)]
bootctl: teach bootctl the new partition type

5 years agobootspec: load entries from both the ESP and XBOOTLDR partitions
Lennart Poettering [Mon, 28 Jan 2019 17:56:53 +0000 (18:56 +0100)]
bootspec: load entries from both the ESP and XBOOTLDR partitions

Let's simply search in both.

5 years agosystemctl: add missing OOM checks
Lennart Poettering [Mon, 28 Jan 2019 18:30:42 +0000 (19:30 +0100)]
systemctl: add missing OOM checks

5 years agosystemctl: use SYNTHETIC_ERRNO() where appropriate
Lennart Poettering [Mon, 28 Jan 2019 18:30:30 +0000 (19:30 +0100)]
systemctl: use SYNTHETIC_ERRNO() where appropriate

5 years agosystemctl: drop arg_esp_path variable from systemctl
Lennart Poettering [Mon, 28 Jan 2019 17:47:01 +0000 (18:47 +0100)]
systemctl: drop arg_esp_path variable from systemctl

It's not set ever (and there's no real need to make it settable, since
users can as well set $SYSTEMD_ESP_PATH to configure this.

5 years agobootspec: store 'root' field in each bootspec entry we load
Lennart Poettering [Mon, 28 Jan 2019 16:57:41 +0000 (17:57 +0100)]
bootspec: store 'root' field in each bootspec entry we load

This 'root' field contains the root path of the partition we found the
snippet in. The 'kernel', 'initrd', 'efi', … fields are relative to this
path.

This becomes particularly useful later when we add support for loading
snippets from both the ESP and XBOOTLDR, but already simplifies the code
for us a bit in systemctl.

5 years agobootspec: add internal APIs to discover the XBOOTLDR partition
Lennart Poettering [Wed, 23 Jan 2019 13:19:40 +0000 (14:19 +0100)]
bootspec: add internal APIs to discover the XBOOTLDR partition

5 years agogpt-auto: also load the boot loader partition during regular boots
Lennart Poettering [Wed, 23 Jan 2019 12:19:41 +0000 (13:19 +0100)]
gpt-auto: also load the boot loader partition during regular boots

5 years agodissect: when mounting an image mount the XBOOTLDR partition to /boot
Lennart Poettering [Wed, 23 Jan 2019 10:53:28 +0000 (11:53 +0100)]
dissect: when mounting an image mount the XBOOTLDR partition to /boot

Previously, we'd mount the ESP to /efi if that existed and was empty,
falling back to /boot if that existed and was empty.

With this change, the XBOOTLDR partition is mounted to /boot
unconditionally. And the EFI is mounted to /efi if that exists (but it
doesn't have to be empty — after all the name is very indicative of what
this is supposed to be), and to /boot as a fallback but only if it
exists and is empty (we insist on emptiness for that, since it might be
used differently than what we assume).

The net effect is that $BOOT should be reliably found under /boot, and
the ESP is either /efi or /boot.

(Note that this commit only is relevant for nspawn and suchlike, i.e.
the codepaths that mount an image without involving udev during boot.)

5 years agodissect: automatically detect boot loader spec $BOOT partition
Lennart Poettering [Wed, 23 Jan 2019 10:34:31 +0000 (11:34 +0100)]
dissect: automatically detect boot loader spec $BOOT partition

The boot loader spec supports two places to store boot loader
configuration: the ESP and a generic replacement for it in case the ESP
is not available or not suitable. Let's look for both.

5 years agogpt: add definition for boot loader spec partition
Lennart Poettering [Tue, 22 Jan 2019 19:57:11 +0000 (20:57 +0100)]
gpt: add definition for boot loader spec partition

As listed in the boot loader spec since a long time:

https://systemd.io/BOOT_LOADER_SPECIFICATION#technical-details

5 years agobootctl: safety check for regular file when reading EFI images
Lennart Poettering [Mon, 28 Jan 2019 16:33:08 +0000 (17:33 +0100)]
bootctl: safety check for regular file when reading EFI images

5 years agobootctl: use SYNTHETIC_ERRNO() where appropriate
Lennart Poettering [Mon, 28 Jan 2019 16:32:46 +0000 (17:32 +0100)]
bootctl: use SYNTHETIC_ERRNO() where appropriate

5 years agodissect: use SYNTHETIC_ERRNO() where appropriate
Lennart Poettering [Wed, 23 Jan 2019 15:59:57 +0000 (16:59 +0100)]
dissect: use SYNTHETIC_ERRNO() where appropriate

5 years agobootspec: use SYNTHETIC_ERRNO() at one more place
Lennart Poettering [Mon, 28 Jan 2019 16:32:04 +0000 (17:32 +0100)]
bootspec: use SYNTHETIC_ERRNO() at one more place

5 years agobootspec: update log message, to indicate the error is ignored
Lennart Poettering [Mon, 28 Jan 2019 16:34:17 +0000 (17:34 +0100)]
bootspec: update log message, to indicate the error is ignored

5 years agofs-util: add new helper syncfs_path()
Lennart Poettering [Wed, 23 Jan 2019 15:08:55 +0000 (16:08 +0100)]
fs-util: add new helper syncfs_path()

5 years agoenv-file: (void)ify an unlink() call
Lennart Poettering [Wed, 6 Feb 2019 16:48:21 +0000 (17:48 +0100)]
env-file: (void)ify an unlink() call

5 years agojson: don't call va_end() twice in json_build()
Lennart Poettering [Fri, 1 Mar 2019 10:00:06 +0000 (11:00 +0100)]
json: don't call va_end() twice in json_build()

This was apparently left-over when json_buildv() was added, and
json_build() just became a wrapper for it.

5 years agosemaphoreci: Run subset of autopkgtests in LXC (#11814)
Martin Pitt [Fri, 1 Mar 2019 09:01:09 +0000 (10:01 +0100)]
semaphoreci: Run subset of autopkgtests in LXC (#11814)

Run build/test in LXC for now, as full nested QEMU is too brittle right
now: https://github.com/semaphoreci/semaphore/issues/37
But this at least runs some tests. It ensures that systemd generally
works in containers, as well as provides some backup results if the main
Ubuntu CI is down.

5 years agoMerge pull request #11852 from keszybz/coverity-memory-issues
Lennart Poettering [Thu, 28 Feb 2019 18:04:04 +0000 (19:04 +0100)]
Merge pull request #11852 from keszybz/coverity-memory-issues

Two small fixes for memory issues found by coverity

5 years agoMerge pull request #11856 from xtopherwong/new-time-zone-list
Lennart Poettering [Thu, 28 Feb 2019 17:57:26 +0000 (18:57 +0100)]
Merge pull request #11856 from xtopherwong/new-time-zone-list

Use new time zone list

5 years agoMerge pull request #11857 from rossburton/acrn
Lennart Poettering [Thu, 28 Feb 2019 17:56:48 +0000 (18:56 +0100)]
Merge pull request #11857 from rossburton/acrn

virt: detect the ACRN hypervisor

5 years agoMerge pull request #11834 from martinpitt/network-test-fixes
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 16:48:41 +0000 (17:48 +0100)]
Merge pull request #11834 from martinpitt/network-test-fixes

networkd-test fix/improvement

5 years agoman: add ACRN hypervisor
Ross Burton [Thu, 28 Feb 2019 15:36:50 +0000 (15:36 +0000)]
man: add ACRN hypervisor

5 years agoBetter C code formatting of arguments in Emacs
Jörg Sommer [Thu, 28 Feb 2019 14:53:40 +0000 (15:53 +0100)]
Better C code formatting of arguments in Emacs

In [PR#11696][1] it came up that the formatting of continued arguments should
follow the default Emacs style. To ensure this happens when someone has changed
his setting in her private config, the value should be set by *dir-locals.el*.

[1]: https://github.com/systemd/systemd/pull/11696#pullrequestreview-205463987

5 years agoMerge pull request #11853 from keszybz/man-rules-update
Lennart Poettering [Thu, 28 Feb 2019 15:17:59 +0000 (16:17 +0100)]
Merge pull request #11853 from keszybz/man-rules-update

man/rules update

5 years agovirt: detect the ACRN hypervisor
Ross Burton [Wed, 30 Jan 2019 16:40:41 +0000 (16:40 +0000)]
virt: detect the ACRN hypervisor

Add magic string and enumeration for the ACRN hypervisor
(https://projectacrn.org).

5 years agotest-time-util: use standard intro and print timezones read from file
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 14:38:16 +0000 (15:38 +0100)]
test-time-util: use standard intro and print timezones read from file

The asserts are OK, but it's also nice to see the list by eye.

5 years agoREADME: mention that we need tzdata >= 2014f
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 14:37:06 +0000 (15:37 +0100)]
README: mention that we need tzdata >= 2014f

zone1970.tab was added in that version. Not that it makes sense to use
outdata timezone tables, but people do strange things.

C.f. https://github.com/nodatime/nodatime/issues/319.

5 years agoman/shutdown: Fix grammar
Theo Ouzhinski [Thu, 28 Feb 2019 13:42:28 +0000 (08:42 -0500)]
man/shutdown: Fix grammar

5 years agoUse new time zone list
Christopher Wong [Thu, 28 Feb 2019 13:22:42 +0000 (14:22 +0100)]
Use new time zone list

When systemd retrieve the time zone it read what is in the file
/usr/share/zoneinfo/zone.tab provided by the Time Zone Database.
According to the comments in zone.tab its content is for backward-
compatibility aid for older programs. New programs should use
zone1970.tab. This patch replaces zone.tab with zone1970.tab.

5 years agosd-bus: deal with cookie overruns
Lennart Poettering [Mon, 25 Feb 2019 10:02:46 +0000 (11:02 +0100)]
sd-bus: deal with cookie overruns

Apparently this happens IRL. Let's carefully deal with issues like this:
when we overrun, let's not go back to zero but instead leave the highest
cookie bit set. We use that as indication that we are in "overrun
territory", and then are particularly careful with checking cookies,
i.e. that they haven't been used for still outstanding replies yet. This
should retain the quick cookie generation behaviour we used to have, but
permits dealing with overruns.

Replaces: #11804
Fixes: #11809

5 years agoman: create .so links for sd_bus_close_{unref,unrefp}
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 12:09:58 +0000 (13:09 +0100)]
man: create .so links for sd_bus_close_{unref,unrefp}

Follow-up for bd62b7448623fbe36665e089977731efb55524c0.

5 years agomeson: remove workaround for old meson bug with command quoting
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 12:06:52 +0000 (13:06 +0100)]
meson: remove workaround for old meson bug with command quoting

Those bugs were fixed a long time ago. Let's take advantage of this and use the
usual $() syntax.

5 years agoMerge pull request #11840 from yuwata/network-route-onlink
Lennart Poettering [Thu, 28 Feb 2019 11:02:08 +0000 (12:02 +0100)]
Merge pull request #11840 from yuwata/network-route-onlink

network: enable GatewayOnLink= if no static address is configured

5 years agoudev-builtin-usb_id: guard against overflow when reading descriptor data
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 10:57:51 +0000 (11:57 +0100)]
udev-builtin-usb_id: guard against overflow when reading descriptor data

CID#996458. Coverity warns that we trust desc->bLength as read in
the input data to adjust our position in the buffer. This value could
be anything, leading to overflow. It's unlikely that the kernel feeds
us invalid data, but let's me more careful.

If any error is encountered, more logs are given.

5 years agoudev-builtin-usb_id: use strjoina to simplify code
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 10:40:44 +0000 (11:40 +0100)]
udev-builtin-usb_id: use strjoina to simplify code

5 years agoshared/install: do not use a temporary variable outside of its scope
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 10:29:38 +0000 (11:29 +0100)]
shared/install: do not use a temporary variable outside of its scope

Coverity says:
> Pointer to local outside scope (RETURN_LOCAL)9.
> use_invalid: Using dirs, which points to an out-of-scope temporary variable of type char const *[5].

And indeed, the switch statement forms a scope. Let's use an if to
avoid creating a scope.

5 years agofuzz: do not assume the existence of /sys/class/net/lo
Yu Watanabe [Thu, 28 Feb 2019 05:02:33 +0000 (14:02 +0900)]
fuzz: do not assume the existence of /sys/class/net/lo

Hopefully fixes oss-fuzz#13440.

5 years agonetwork: wrap long lines
Yu Watanabe [Thu, 28 Feb 2019 01:57:20 +0000 (10:57 +0900)]
network: wrap long lines

5 years agonetwork: simplify config_parse_lifetime()
Yu Watanabe [Thu, 28 Feb 2019 01:56:33 +0000 (10:56 +0900)]
network: simplify config_parse_lifetime()

5 years agonetwork: avoid address section freed
Yu Watanabe [Thu, 28 Feb 2019 01:54:17 +0000 (10:54 +0900)]
network: avoid address section freed

Otherwise, if HomeAddress= or friends are specified at the first line of
a section, then its assignment will be ignored.

5 years agonetwork: cleanup logging in route related config parsers
Yu Watanabe [Thu, 28 Feb 2019 01:39:14 +0000 (10:39 +0900)]
network: cleanup logging in route related config parsers

5 years agonetwork: do not override previously specified family
Yu Watanabe [Thu, 28 Feb 2019 01:37:58 +0000 (10:37 +0900)]
network: do not override previously specified family

5 years agotest-network: add testcase for #1850
Yu Watanabe [Wed, 27 Feb 2019 10:10:47 +0000 (19:10 +0900)]
test-network: add testcase for #1850

5 years agonetwork: enable GatewayOnLink= if Gateway= without static address configured
Yu Watanabe [Wed, 27 Feb 2019 09:41:49 +0000 (18:41 +0900)]
network: enable GatewayOnLink= if Gateway= without static address configured

And warn about that.

But this only done if GatewayOnLink= is not specified. When it is
explicitly disabled, then the flag will not be set.

5 years agonetwork: save GatewayOnLink= value as tristate in Route
Yu Watanabe [Thu, 28 Feb 2019 01:10:38 +0000 (10:10 +0900)]
network: save GatewayOnLink= value as tristate in Route

This should not change any behavior. But used in the later commit.

5 years agonetwork: relax the .network file check
Yu Watanabe [Wed, 27 Feb 2019 09:22:40 +0000 (18:22 +0900)]
network: relax the .network file check

Previously, if a .networ file contains invalid [Address] or [Route]
section, then the file is completely dropped. This makes networkd
just drops invalid sections.

5 years agonetwork: rename GatewayOnlink= to GatewayOnLink=
Yu Watanabe [Wed, 27 Feb 2019 08:43:08 +0000 (17:43 +0900)]
network: rename GatewayOnlink= to GatewayOnLink=

But still GatewayOnlink= is supported for backward compatibility.

5 years agonetworkd-test: ignore failures of test_route_only_dns* in containers
Martin Pitt [Wed, 27 Feb 2019 22:15:31 +0000 (23:15 +0100)]
networkd-test: ignore failures of test_route_only_dns* in containers

This test exposes a race condition when running in LXC, see issue #11848
for details. Until that is understood and fixed, skip the test as it's
not a recent regression.

5 years agonetworkd-test: specify Address= with prefix length
Martin Pitt [Tue, 26 Feb 2019 22:05:05 +0000 (23:05 +0100)]
networkd-test: specify Address= with prefix length

This avoids a warning:

    An address '192.168.42.100' is specified without prefix length. The
    behavior of parsing addresses without prefix length will be changed
    in the future release. Please specify prefix length explicitly.

5 years agonetworkd-test: show service journal on startup failure
Martin Pitt [Tue, 26 Feb 2019 22:03:35 +0000 (23:03 +0100)]
networkd-test: show service journal on startup failure

This provides easier evaluation of failed tests.

5 years agoMerge pull request #11795 from yuwata/fix-network-routing-policy-11280
Lennart Poettering [Wed, 27 Feb 2019 17:43:56 +0000 (18:43 +0100)]
Merge pull request #11795 from yuwata/fix-network-routing-policy-11280

network: fix routing policy rule issue #11280

5 years agojournalctl: New option --cursor-file
Jörg Sommer [Mon, 11 Feb 2019 23:19:13 +0000 (00:19 +0100)]
journalctl: New option --cursor-file

The option cursor-file takes a filename as argument. If the file exists and
contains a valid cursor, this is used to start the output after this position.
At the end, the last cursor gets written to the file.

This allows for an easy implementation of a timer that regularly looks in the
journal for some messages.

    journalctl --cursor-file err-cursor -b -p err
    journalctl --cursor-file audit-cursor -t audit --grep DENIED

Or you might want to walk the journal in steps of 10 messages:

    journalctl --cursor-file ./curs -n10 --since=today -t systemd

5 years agoMerge pull request #11844 from keszybz/networkd-fuzzer-fixes
Lennart Poettering [Wed, 27 Feb 2019 16:45:55 +0000 (17:45 +0100)]
Merge pull request #11844 from keszybz/networkd-fuzzer-fixes

Networkd fuzzer fixes

5 years agoMerge pull request #11807 from yuwata/test-vlan-mtu
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 16:15:29 +0000 (17:15 +0100)]
Merge pull request #11807 from yuwata/test-vlan-mtu

network: increase MTU if VLAN= or MACVLAN= requests higher value

5 years agoanalyze security: check for ProtectHostname=yes
Topi Miettinen [Wed, 27 Feb 2019 13:26:43 +0000 (15:26 +0200)]
analyze security: check for ProtectHostname=yes

5 years agonetworkd: refuse more than 128 NTP servers
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 13:45:29 +0000 (14:45 +0100)]
networkd: refuse more than 128 NTP servers

This test case is a bit silly, but it shows that our code is unprepared to
handle so many network servers, with quadratic complexity in various places.
I don't think there are any valid reasons to have hundres of NTP servers
configured, so let's just emit a warning and cut the list short.

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

5 years agonetworkd: fix memleak when the same NetDev is specified twice
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 13:15:29 +0000 (14:15 +0100)]
networkd: fix memleak when the same NetDev is specified twice

hashmap_put() returns 0 if the (key, value) pair is already present in the
hashmap, and -EEXIST if the key exists, but the value is different.

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

5 years agonetwork: wrap some long lines
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 12:34:51 +0000 (13:34 +0100)]
network: wrap some long lines

5 years agoselinux: don't log SELINUX_INFO and SELINUX_WARNING messages to audit
Michal Sekletar [Tue, 26 Feb 2019 16:33:27 +0000 (17:33 +0100)]
selinux: don't log SELINUX_INFO and SELINUX_WARNING messages to audit

Previously we logged even info message from libselinux as USER_AVC's to
audit. For example, setting SELinux to permissive mode generated
following audit message,

time->Tue Feb 26 11:29:29 2019
type=USER_AVC msg=audit(1551198569.423:334): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  received setenforce notice (enforcing=0)  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

This is unnecessary and wrong at the same time. First, kernel already
records audit event that SELinux was switched to permissive mode, also
the type of the message really shouldn't be USER_AVC.

Let's ignore SELINUX_WARNING and SELINUX_INFO and forward to audit only
USER_AVC's and errors as these two libselinux message types have clear
mapping to audit message types.

5 years agoman: clarify whitespace handling in systemd.syntax
Davide Cavalca [Tue, 26 Feb 2019 21:08:02 +0000 (16:08 -0500)]
man: clarify whitespace handling in systemd.syntax

5 years agoMerge pull request #11837 from yuwata/network-tiny-cleanups
Lennart Poettering [Wed, 27 Feb 2019 10:26:47 +0000 (11:26 +0100)]
Merge pull request #11837 from yuwata/network-tiny-cleanups

network: tiny cleanups

5 years agotest-network: add testcase for issue #11280
Yu Watanabe [Fri, 22 Feb 2019 03:28:51 +0000 (12:28 +0900)]
test-network: add testcase for issue #11280

5 years agotest-network: drop relevant ip routing policy rules before testing
Yu Watanabe [Wed, 27 Feb 2019 10:22:27 +0000 (19:22 +0900)]
test-network: drop relevant ip routing policy rules before testing

5 years agonetwork: fix error code in log
Yu Watanabe [Wed, 27 Feb 2019 04:54:13 +0000 (13:54 +0900)]
network: fix error code in log

5 years agonetwork: merge conditions and use FLAGS_SET() macro
Yu Watanabe [Tue, 26 Feb 2019 05:36:07 +0000 (14:36 +0900)]
network: merge conditions and use FLAGS_SET() macro

5 years agonetwork: make ndisc_router_process_options() propagate error
Yu Watanabe [Tue, 26 Feb 2019 05:34:25 +0000 (14:34 +0900)]
network: make ndisc_router_process_options() propagate error

And its caller ignore the error.

5 years agofs-util: add missing linux/falloc.h include
Davide Cavalca [Tue, 26 Feb 2019 21:09:40 +0000 (16:09 -0500)]
fs-util: add missing linux/falloc.h include

5 years agonetwork: do not remove rule when it is requested by existing links
Yu Watanabe [Fri, 22 Feb 2019 04:32:47 +0000 (13:32 +0900)]
network: do not remove rule when it is requested by existing links

Otherwise, the first link once removes all saved rules in the foreign
rule database, and the second or later links create again...

5 years agonetwork: remove routing policy rule from foreign rule database when it is removed
Yu Watanabe [Fri, 22 Feb 2019 04:27:44 +0000 (13:27 +0900)]
network: remove routing policy rule from foreign rule database when it is removed

Previously, When the first link configures rules, it removes all saved
rules, which were configured by networkd previously, in the foreign rule
database, but the rules themselves are still in the database.
Thus, when the second or later link configures rules, it errnously
treats the rules already exist.
This is the root of issue #11280.

This removes rules from the foreign database when they are removed.

Fixes #11280.

5 years agotest-network: add test for MTUBytes= in vlan or macvlan devices
Yu Watanabe [Sat, 23 Feb 2019 10:25:01 +0000 (19:25 +0900)]
test-network: add test for MTUBytes= in vlan or macvlan devices

5 years agonetwork: bump mtu if stacked vlan or macvlan requests larger size
Yu Watanabe [Wed, 27 Feb 2019 00:57:16 +0000 (09:57 +0900)]
network: bump mtu if stacked vlan or macvlan requests larger size

Closes #5972.

5 years agoMerge pull request #11824 from keszybz/fuzzer-fixes
Lennart Poettering [Tue, 26 Feb 2019 18:02:12 +0000 (19:02 +0100)]
Merge pull request #11824 from keszybz/fuzzer-fixes

Fuzzer fixes

5 years agoMerge pull request #11827 from keszybz/pkgconfig-variables
Lennart Poettering [Tue, 26 Feb 2019 17:58:03 +0000 (18:58 +0100)]
Merge pull request #11827 from keszybz/pkgconfig-variables

Allow overriding pkgconfig prefixes

5 years agoMerge pull request #11357 from GiacintoCifelli/dbus_labels
Lennart Poettering [Tue, 26 Feb 2019 16:22:04 +0000 (17:22 +0100)]
Merge pull request #11357 from GiacintoCifelli/dbus_labels

sd-bus: add methods and signals parameter names

5 years agoMerge pull request #11823 from keszybz/more-fuzz-coverage
Lennart Poettering [Tue, 26 Feb 2019 16:21:32 +0000 (17:21 +0100)]
Merge pull request #11823 from keszybz/more-fuzz-coverage

More fuzz coverage

5 years agofuzz-ndisc-rs: avoid assertion failure on samples which dont fit in pipe
Zbigniew Jędrzejewski-Szmek [Tue, 26 Feb 2019 12:12:53 +0000 (13:12 +0100)]
fuzz-ndisc-rs: avoid assertion failure on samples which dont fit in pipe

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

5 years agofuzz-lldp: avoid assertion failure on samples which dont fit in pipe
Zbigniew Jędrzejewski-Szmek [Tue, 26 Feb 2019 12:12:53 +0000 (13:12 +0100)]
fuzz-lldp: avoid assertion failure on samples which dont fit in pipe

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

5 years agofuzz-journal-stream: avoid assertion failure on samples which don't fit in pipe
Zbigniew Jędrzejewski-Szmek [Tue, 26 Feb 2019 12:00:35 +0000 (13:00 +0100)]
fuzz-journal-stream: avoid assertion failure on samples which don't fit in pipe

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11587.
We had a sample which was large enough that write(2) failed to push all the
data into the pipe, and an assert failed. The code could be changed to use
a loop, but then we'd need to interleave writes and sd_event_run (to process
the journal). I don't think the complexity is worth it — fuzzing works best
if the sample is not too huge anyway. So let's just reject samples above 64k,
and tell oss-fuzz about this limit.

5 years agosd-bus: add methods and signals parameter names. Fixes: #1564
Giacinto Cifelli [Tue, 8 Jan 2019 11:14:37 +0000 (12:14 +0100)]
sd-bus: add methods and signals parameter names. Fixes: #1564

5 years agoshared/ask-password-api: when echoing multi-byte characters, print the whole sequence
Zbigniew Jędrzejewski-Szmek [Tue, 26 Feb 2019 11:43:07 +0000 (12:43 +0100)]
shared/ask-password-api: when echoing multi-byte characters, print the whole sequence

This is untested, but I don't see how the previous code could have worked
for multibyte characters (with echo on).

5 years agobasic/utf8: do not read past end of string when looking for a multi-byte character
Zbigniew Jędrzejewski-Szmek [Tue, 26 Feb 2019 11:37:40 +0000 (12:37 +0100)]
basic/utf8: do not read past end of string when looking for a multi-byte character

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

5 years agobasic/utf8: change type of function to emphasize that it only looks at one character
Zbigniew Jędrzejewski-Szmek [Tue, 26 Feb 2019 11:17:12 +0000 (12:17 +0100)]
basic/utf8: change type of function to emphasize that it only looks at one character

5 years agoMerge pull request #11822 from yuwata/fuzz-udev-database
Lennart Poettering [Tue, 26 Feb 2019 09:26:38 +0000 (10:26 +0100)]
Merge pull request #11822 from yuwata/fuzz-udev-database

fuzz: add fuzzer for udev database

5 years agocore: consider non-SERVICE_EXEC_START commands for EXIT_CLEAN_COMMAND
Anita Zhang [Thu, 21 Feb 2019 18:37:40 +0000 (10:37 -0800)]
core: consider non-SERVICE_EXEC_START commands for EXIT_CLEAN_COMMAND

When there are multiple ExecStop= statements, the next command would continue
to run even after TimeoutStopSec= is up and sends SIGTERM. This is because,
unless Type= is oneshot, the exit code/status would evaluate to SERVICE_SUCCESS
in service_sigchld_event()'s call to is_clean_exit(). This success indicates
following commands would continue running until the end of the list
is reached, or another timeout is hit and SIGKILL is sent.

Since long running processes should not be invoked in non-SERVICE_EXEC_START
commands, consider them for EXIT_CLEAN_COMMAND instead of EXIT_CLEAN_DAEMON.
Passing EXIT_CLEAN_COMMAND to is_clean_exit() evaluates the SIGTERM exit
code/status to failure and will stop execution after the first timeout is hit.

Fixes #11431

5 years agoMerge pull request #11780 from yuwata/fix-4211
Zbigniew Jędrzejewski-Szmek [Tue, 26 Feb 2019 07:31:32 +0000 (08:31 +0100)]
Merge pull request #11780 from yuwata/fix-4211

network: skip .network files earlier when conditions do not match system environment

5 years agofuzz: add a sample for fuzz-udev-database
Yu Watanabe [Tue, 26 Feb 2019 04:21:13 +0000 (13:21 +0900)]
fuzz: add a sample for fuzz-udev-database

5 years agofuzz: add fuzzer for udev database
Yu Watanabe [Tue, 26 Feb 2019 04:10:31 +0000 (13:10 +0900)]
fuzz: add fuzzer for udev database

5 years agosd-device: split device_read_db_internal() into two part
Yu Watanabe [Tue, 26 Feb 2019 03:55:40 +0000 (12:55 +0900)]
sd-device: split device_read_db_internal() into two part

The new device_read_db_internal_filename() will be used by a fuzzer.

5 years agocryptsetup: Treat key file errors as a failed password attempt
Ryan Gonzalez [Sat, 23 Feb 2019 05:45:03 +0000 (23:45 -0600)]
cryptsetup: Treat key file errors as a failed password attempt

6f177c7dc092eb68762b4533d41b14244adb2a73 caused key file errors to immediately fail, which would make it hard to correct an issue due to e.g. a crypttab typo or a damaged key file.

Closes #11723.

5 years agonetwork: assign Network::manager when it is listed to the manager object.
Yu Watanabe [Fri, 22 Feb 2019 00:38:19 +0000 (09:38 +0900)]
network: assign Network::manager when it is listed to the manager object.

Now Network::manager is not necessary during parsing configs.

C.f. 838b2f7a30dbb68f4d6939626a165b313cc94542.

5 years agonetwork: make resolving NetDev names delayed and moved to network_verify()
Yu Watanabe [Thu, 21 Feb 2019 07:40:34 +0000 (16:40 +0900)]
network: make resolving NetDev names delayed and moved to network_verify()

And before resolving NetDev names, check conditions in .network,
and if they do not match the system environment, drop the network
unit earlier.

Fixes #4211.

5 years agonetwork: add debug log when conditions do not match system environment
Yu Watanabe [Thu, 21 Feb 2019 07:41:47 +0000 (16:41 +0900)]
network: add debug log when conditions do not match system environment