Commit graph

26059 commits

Author SHA1 Message Date
Lennart Poettering cee97d5768
Merge pull request #12836 from yuwata/tree-wide-replace-strjoin
tree-wide: replace strjoin() with path_join()
2019-06-22 20:02:46 +02:00
Anita Zhang 4c1567f29a bpf-firewall: optimization for IPAddressXYZ="any" (and unprivileged users)
This is a workaround to make IPAddressDeny=any/IPAddressAllow=any work
for non-root users that have CAP_NET_ADMIN. "any" was chosen since
all or nothing network access is one of the most common use cases for
isolation.

Allocating BPF LPM TRIE maps require CAP_SYS_ADMIN while BPF_PROG_TYPE_CGROUP_SKB
only needs CAP_NET_ADMIN. In the case of IPAddressXYZ="any" we can just
consistently return false/true to avoid allocating the map and limit the user
to having CAP_NET_ADMIN.
2019-06-22 19:56:06 +02:00
Topi Miettinen e48fcfef06 cgroup-util: kill also threads
It's possible for a zombie process to have live threads. These are not listed
in /sys in "cgroup.procs" for cgroupsv2, but they show up in
"cgroup.threads" (cgroupv2) or "tasks" (cgroupv1) nodes. When killing a
cgroup (v2 only) with SIGKILL, let's also kill threads after killing processes,
so the live threads of a zombie get killed too.

Closes #12262.
2019-06-22 18:35:48 +02:00
Lennart Poettering c6134d3e2f path-util: get rid of prefix_root()
prefix_root() is equivalent to path_join() in almost all ways, hence
let's remove it.

There are subtle differences though: prefix_root() will try shorten
multiple "/" before and after the prefix. path_join() doesn't do that.
This means prefix_root() might return a string shorter than both its
inputs combined, while path_join() never does that. I like the
path_join() semantics better, hence I think dropping prefix_root() is
totally OK. In the end the strings generated by both functon should
always be identical in terms of path_equal() if not streq().

This leaves prefix_roota() in place. Ideally we'd have path_joina(), but
I don't think we can reasonably implement that as a macro. or maybe we
can? (if so, sounds like something for a later PR)

Also add in a few missing OOM checks
2019-06-21 08:42:55 +09:00
Anita Zhang f66ad46066 nspawn: don't hard fail when setting capabilities
The OCI changes in #9762 broke a use case in which we use nspawn from
inside a container that has dropped capabilities from the bounding set
that nspawn expected to retain. In an attempt to keep OCI compliance
and support our use case, I made hard failing on setting capabilities
not in the bounding set optional (hard fail if using OCI and log only
if using nspawn cmdline).

Fixes #12539
2019-06-20 21:46:36 +02:00
Yu Watanabe a5a4dfa1bc
Merge pull request #12846 from poettering/cap-last-cap-fix
cap_last_cap() off by one fixes
2019-06-21 03:31:49 +09:00
Lennart Poettering 1e59b5455e bpf: use more TAKE_FD() 2019-06-21 03:28:24 +09:00
Yu Watanabe a13de89d36 sd-path: use _cleanup_ attribute 2019-06-21 03:26:23 +09:00
Yu Watanabe 657ee2d82b tree-wide: replace strjoin() with path_join() 2019-06-21 03:26:16 +09:00
Lennart Poettering 3972004297 bus-creds: fix size calculation for storing caps data
This is a bit confusing, hence let's at an example comment.
2019-06-20 14:55:30 +02:00
Lennart Poettering 4a33a02e99 capability: fix loops for cap_last_cap()
cap_last_cap() returns the last valid cap (instead of the number of
valid caps). to iterate through all known caps we hence need to use a <=
check, and not a < check like for all other cases. We got this right
usually, but in three cases we did not.
2019-06-20 14:55:24 +02:00
Lennart Poettering 762267cdc1
Merge pull request #12762 from yuwata/network-introduce-carrier-and-network-state-12752
network: introduce carrier and address state to fix network_is_online()
2019-06-20 13:36:30 +02:00
Lennart Poettering 64ef83139c
Merge pull request #12837 from yuwata/tree-wide-lgtm-fixes
tree-wide: fix issues found by lgtm
2019-06-20 12:35:34 +02:00
Donald Buczek 0219b3524f cgroup: Continue unit reset if cgroup is busy
When part of the cgroup hierarchy cannot be deleted (e.g. because there
are still processes in it), do not exit unit_prune_cgroup early, but
continue so that u->cgroup_realized is reset.

Log the known case of non-empty cgroups at debug level and other errors
at warning level.

Fixes https://github.com/systemd/systemd/issues/12386
2019-06-20 10:16:53 +02:00
Yu Watanabe b19eab1f74
Merge pull request #12806 from yuwata/networkctl-ethtool-12657
networkctl: show speed, duplex, auto negotiation, and port
2019-06-20 06:56:37 +09:00
Yu Watanabe 31a9be2372 util: use extract_first_word() instead of strsep() 2019-06-20 06:51:34 +09:00
Yu Watanabe fe2e4b6961 tree-wide: use htobe{32,16}() instead of hton{l,s}() 2019-06-20 06:34:05 +09:00
Yu Watanabe 6d946490ba tree-wide: drop alloca() in loop 2019-06-20 06:29:19 +09:00
Yu Watanabe c967d2c7ce networkctl: show link speed, duplex, auto negotiation, and port 2019-06-20 04:42:55 +09:00
Yu Watanabe 42a63431d3 network: change type of BitRates= bus property 2019-06-19 23:15:19 +09:00
Yu Watanabe 9ff27e6413 table: introduce FORMAT_BPS type 2019-06-19 23:15:19 +09:00
Yu Watanabe 049025a415 test: add tests for format_bytes() 2019-06-19 23:15:19 +09:00
Yu Watanabe b7de125bba util: make format_bytes() support e.g. 3.0E 2019-06-19 23:15:19 +09:00
Yu Watanabe aa89266900 util: introduce format_bytes_full()
And move it into format-util.c.
2019-06-19 23:15:19 +09:00
Yu Watanabe 33a8695fdc ethtool-util: introduce ethtool_get_link_info()
Will be used in later commits.
2019-06-19 23:15:19 +09:00
Yu Watanabe 7864b16b27 ethtool-util: make ethtool_connect() warn on failure 2019-06-19 23:15:19 +09:00
Yu Watanabe b9bc7d42e3 ethtool-util: use structured initializers 2019-06-19 23:15:13 +09:00
Frantisek Sumsal f9dc94408d sd-resolve: suppress false positive MSan warnings
MSan dislikes structured initializers for nested structures.
2019-06-19 15:48:36 +02:00
Zbigniew Jędrzejewski-Szmek 23ebb4dda9
Merge pull request #12828 from yuwata/network-routing-policy-rule-add-missing-entries
network: add missing entries in routing_policy_rule_{hash,compare}_func()
2019-06-19 15:25:31 +02:00
Lennart Poettering 43786739bf
Merge pull request #12815 from irtimmer/dot-strict
resolved: strict mode for DNS-over-TLS
2019-06-19 14:56:36 +02:00
Yu Watanabe b80a511b1b network: add missing entries in routing_policy_rule_{hash,compare}_func()
This also makes routing_policy_rule_get() or friends take
a RoutingPolicyRule object as an input.
2019-06-19 21:10:07 +09:00
Yu Watanabe f3f0d873e2 util: introduce siphash24_compress_boolean() 2019-06-19 21:03:16 +09:00
Iwan Timmer 9c0624dcdb resolved: support TLS 1.3 when using GnuTLS for DNS-over-TLS 2019-06-19 13:10:44 +02:00
Iwan Timmer 4310bfc20b resolved: add strict mode for DNS-over-TLS
Add strict mode for DNS-over-TLS, which will require TLS support from the server. Closes #10755
2019-06-19 13:10:44 +02:00
Iwan Timmer aedf00a2bd resolved: don't require check when importing resolved-dnstls.h 2019-06-19 13:10:44 +02:00
Lennart Poettering a4eb991831
Merge pull request #12829 from yuwata/dhcp-memdup_suffix0
sd-bus,dhcp: use memdup_suffix0() instead of strndup()
2019-06-19 09:00:52 +02:00
Yu Watanabe bccd916292 sd-bus: use memdup_suffix0() instead of strndup() 2019-06-19 14:29:00 +09:00
Yu Watanabe 79cd22d6f3 dhcp: use memdup_suffix0() instead of strndup() 2019-06-19 14:15:42 +09:00
Yu Watanabe a057135bce
Merge pull request #12822 from poettering/tmpfiles-is-mount-point
tmpfiles: use common fd_is_mount_point() implementation
2019-06-19 11:11:06 +09:00
Yu Watanabe 5c2316c605 ethtool-util: move from src/udev/net/ to src/shared/ 2019-06-19 09:03:50 +09:00
Lennart Poettering d9adc8a863 journald: use memdup_suffix0() when copying string from potentially binary data
Fixes: #12484
2019-06-18 20:53:46 +03:00
Iwan Timmer 71a681ae50 resolved: add missing error code check when initializing DNS-over-TLS 2019-06-18 19:16:36 +02:00
Iwan Timmer e22c5b2064 resolved: move TLS data shared by all servers to manager
Instead of having a context and/or trusted CA list per server this is now moved to the server. Ensures future TLS configuration options are global instead of per server.
2019-06-18 19:16:36 +02:00
Markus Felten 1faba68fd7 fix(journal-gatewayd): use relative urls (not starting with '/')
if journal-gatewayd http is not mounted at '/' (proxy request)
the request lose their initial path component
2019-06-18 17:06:12 +02:00
Frantisek Sumsal 31c9d74d50 hashmap: avoid using TLS in a destructor
Using C11 thread-local storage in destructors causes uninitialized
read. Let's avoid that using a direct comparison instead of using
the cached values. As this code path is taken only when compiled
with -DVALGRIND=1, the performance cost shouldn't matter too much.

Fixes #12814
2019-06-18 13:59:12 +02:00
Lennart Poettering 59da64738b
Merge pull request #12758 from fbuihuu/nspawn-console-tty
Create nspawn console tty in the child
2019-06-18 13:17:14 +02:00
Lennart Poettering 60bdc0ca22 tmpfiles: use common fd_is_mount_point() implementation in tmpfiles.c
No need to have a private reimplementation here. Let's just use the
common one, which supports "fdinfo" as fallback.
2019-06-18 12:42:30 +02:00
Lennart Poettering 20b6bb9560 tmpfiles: merge two nested if checks into one 2019-06-18 12:41:31 +02:00
Lennart Poettering 113ed3be37 tmpfiles: use path_join() where we can 2019-06-18 12:41:02 +02:00
Yu Watanabe 3d9f670783 dhcp: fix comparison with previous lease
Follow-up for f8862395e8.

Fixes #12816.
2019-06-18 10:27:59 +02:00