Commit graph

38755 commits

Author SHA1 Message Date
David Michael 8595c4588c TEST-22: add test for unprivileged dirs in root prefixes
This verifies the fix for the issue described in:
https://github.com/systemd/systemd/pull/11820
2019-02-28 13:06:07 -05:00
David Michael c3aa4adcaf tmpfiles: pass arg_root to chase_symlinks as the root prefix
This informs chase_symlinks that symlinks should be treated as if
the path given by --root= is the root of their file system.

With the parent commit, this allows tmpfiles to create files as the
root user under a prefix that may be owned by an unprivileged user.
In particular, this fixes the case where tmpfiles generates initial
files in a staging root directory for packaging under a directory
owned by the unprivileged packager user (e.g. in Gentoo).
2019-02-28 13:06:07 -05:00
David Michael cc14a6c011 fs-util: exempt root prefix directories from UID checks
When chase_symlinks is given a root path, it is assumed that all
processed symlinks are restricted under that path.  It should not
be necessary to verify components of that prefix path since they
are not relevant to the symlinks.

This change skips unsafe UID transitions in this root prefix, i.e.
it now ignores when an unprivileged user's directory contains a
root-owned directory above the symlink root.
2019-02-28 13:05:58 -05:00
Lennart Poettering 8e4fbe3f2d
Merge pull request #11852 from keszybz/coverity-memory-issues
Two small fixes for memory issues found by coverity
2019-02-28 19:04:04 +01:00
Lennart Poettering 04d7ca0228
Merge pull request #11856 from xtopherwong/new-time-zone-list
Use new time zone list
2019-02-28 18:57:26 +01:00
Lennart Poettering 737e2f306e
Merge pull request #11857 from rossburton/acrn
virt: detect the ACRN hypervisor
2019-02-28 18:56:48 +01:00
Zbigniew Jędrzejewski-Szmek 2fe4c28d30
Merge pull request #11834 from martinpitt/network-test-fixes
networkd-test fix/improvement
2019-02-28 17:48:41 +01:00
Ross Burton 0f0e30ad9c man: add ACRN hypervisor 2019-02-28 15:55:23 +00:00
Jörg Sommer df3489ab1b 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
2019-02-28 16:50:53 +01:00
Lennart Poettering 154c83e1b9
Merge pull request #11853 from keszybz/man-rules-update
man/rules update
2019-02-28 16:17:59 +01:00
Ross Burton 095b9cf45a virt: detect the ACRN hypervisor
Add magic string and enumeration for the ACRN hypervisor
(https://projectacrn.org).
2019-02-28 14:43:51 +00:00
Zbigniew Jędrzejewski-Szmek f0e2e0db00 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.
2019-02-28 15:38:52 +01:00
Zbigniew Jędrzejewski-Szmek 781748af45 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.
2019-02-28 15:38:47 +01:00
Theo Ouzhinski fa44cecae2 man/shutdown: Fix grammar 2019-02-28 15:17:32 +01:00
Christopher Wong ba32084f08 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.
2019-02-28 14:58:43 +01:00
Lennart Poettering 1f82f5bb42 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
2019-02-28 13:44:05 +01:00
Zbigniew Jędrzejewski-Szmek 2dfdf9c4b2 man: create .so links for sd_bus_close_{unref,unrefp}
Follow-up for bd62b74486.
2019-02-28 13:10:08 +01:00
Zbigniew Jędrzejewski-Szmek 9e08359864 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.
2019-02-28 13:10:08 +01:00
Lennart Poettering e19ebdd66d
Merge pull request #11840 from yuwata/network-route-onlink
network: enable GatewayOnLink= if no static address is configured
2019-02-28 12:02:08 +01:00
Zbigniew Jędrzejewski-Szmek 760034bebe 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.
2019-02-28 11:57:51 +01:00
Zbigniew Jędrzejewski-Szmek 8bdca77c40 udev-builtin-usb_id: use strjoina to simplify code 2019-02-28 11:40:44 +01:00
Zbigniew Jędrzejewski-Szmek a05294ff05 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.
2019-02-28 11:29:38 +01:00
Yu Watanabe 358fb6862b fuzz: do not assume the existence of /sys/class/net/lo
Hopefully fixes oss-fuzz#13440.
2019-02-28 10:38:16 +01:00
Yu Watanabe 2850cd40ee network: wrap long lines 2019-02-28 10:57:20 +09:00
Yu Watanabe 33680b0a26 network: simplify config_parse_lifetime() 2019-02-28 10:56:33 +09:00
Yu Watanabe 4aa4c4b0f4 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.
2019-02-28 10:54:20 +09:00
Yu Watanabe f205a92a5c network: cleanup logging in route related config parsers 2019-02-28 10:39:14 +09:00
Yu Watanabe 01d4e7323c network: do not override previously specified family 2019-02-28 10:37:58 +09:00
Yu Watanabe af3b1498c6 test-network: add testcase for #1850 2019-02-28 10:34:27 +09:00
Yu Watanabe 4912ab7774 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.
2019-02-28 10:34:21 +09:00
Yu Watanabe 54901fd222 network: save GatewayOnLink= value as tristate in Route
This should not change any behavior. But used in the later commit.
2019-02-28 10:16:55 +09:00
Yu Watanabe 4bec2f237b 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.
2019-02-28 10:01:56 +09:00
Yu Watanabe 9cb8c55934 network: rename GatewayOnlink= to GatewayOnLink=
But still GatewayOnlink= is supported for backward compatibility.
2019-02-28 10:00:22 +09:00
Martin Pitt 09b8826ea3 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.
2019-02-27 23:15:31 +01:00
Martin Pitt 829c0672e0 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.
2019-02-27 22:53:57 +01:00
Martin Pitt 74c13b7659 networkd-test: show service journal on startup failure
This provides easier evaluation of failed tests.
2019-02-27 22:53:57 +01:00
Lennart Poettering dc16327c48
Merge pull request #11795 from yuwata/fix-network-routing-policy-11280
network: fix routing policy rule issue #11280
2019-02-27 18:43:56 +01:00
Jörg Sommer d9e15cbd18 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
2019-02-27 18:43:31 +01:00
Lennart Poettering 200fb167a2
Merge pull request #11844 from keszybz/networkd-fuzzer-fixes
Networkd fuzzer fixes
2019-02-27 17:45:55 +01:00
Zbigniew Jędrzejewski-Szmek 4b151b7132
Merge pull request #11807 from yuwata/test-vlan-mtu
network: increase MTU if VLAN= or MACVLAN= requests higher value
2019-02-27 17:15:29 +01:00
Topi Miettinen 527bd7f185 analyze security: check for ProtectHostname=yes 2019-02-27 16:20:38 +01:00
Zbigniew Jędrzejewski-Szmek c448459d56 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
2019-02-27 14:52:33 +01:00
Zbigniew Jędrzejewski-Szmek 83ec459276 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
2019-02-27 14:31:28 +01:00
Zbigniew Jędrzejewski-Szmek 3772cfde03 network: wrap some long lines 2019-02-27 13:35:19 +01:00
Michal Sekletar 6227fc14c4 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.
2019-02-27 12:17:19 +01:00
Davide Cavalca 170342c90b man: clarify whitespace handling in systemd.syntax 2019-02-27 11:27:51 +01:00
Lennart Poettering 7bd90528b4
Merge pull request #11837 from yuwata/network-tiny-cleanups
network: tiny cleanups
2019-02-27 11:26:47 +01:00
Yu Watanabe b677774d69 test-network: add testcase for issue #11280 2019-02-27 19:24:13 +09:00
Yu Watanabe 703bc7a2a6 test-network: drop relevant ip routing policy rules before testing 2019-02-27 19:23:46 +09:00
Yu Watanabe 80be3de31f network: fix error code in log 2019-02-27 16:48:19 +09:00