Commit Graph

904 Commits

Author SHA1 Message Date
Jan Klötzke dc653bf487 service: handle abort stops with dedicated timeout
When shooting down a service with SIGABRT the user might want to have a
much longer stop timeout than on regular stops/shutdowns. Especially in
the face of short stop timeouts the time might not be sufficient to
write huge core dumps before the service is killed.

This commit adds a dedicated (Default)TimeoutAbortSec= timer that is
used when stopping a service via SIGABRT. In all other cases the
existing TimeoutStopSec= is used. The timer value is unset by default
to skip the special handling and use TimeoutStopSec= for state
'stop-watchdog' to keep the old behaviour.

If the service is in state 'stop-watchdog' and the service should be
stopped explicitly we still go to 'stop-sigterm' and re-apply the usual
TimeoutStopSec= timeout.
2019-04-12 17:32:52 +02:00
Chris Down c52db42b78 cgroup: Implement default propagation of MemoryLow with DefaultMemoryLow
In cgroup v2 we have protection tunables -- currently MemoryLow and
MemoryMin (there will be more in future for other resources, too). The
design of these protection tunables requires not only intermediate
cgroups to propagate protections, but also the units at the leaf of that
resource's operation to accept it (by setting MemoryLow or MemoryMin).

This makes sense from an low-level API design perspective, but it's a
good idea to also have a higher-level abstraction that can, by default,
propagate these resources to children recursively. In this patch, this
happens by having descendants set memory.low to N if their ancestor has
DefaultMemoryLow=N -- assuming they don't set a separate MemoryLow
value.

Any affected unit can opt out of this propagation by manually setting
`MemoryLow` to some value in its unit configuration. A unit can also
stop further propagation by setting `DefaultMemoryLow=` with no
argument. This removes further propagation in the subtree, but has no
effect on the unit itself (for that, use `MemoryLow=0`).

Our use case in production is simplifying the configuration of machines
which heavily rely on memory protection tunables, but currently require
tweaking a huge number of unit files to make that a reality. This
directive makes that significantly less fragile, and decreases the risk
of misconfiguration.

After this patch is merged, I will implement DefaultMemoryMin= using the
same principles.
2019-04-12 17:23:58 +02:00
Lennart Poettering b51629ad84
Merge pull request #12222 from yuwata/macsec
network: introduce MACsec
2019-04-12 13:59:30 +02:00
Zbigniew Jędrzejewski-Szmek cc5549ca12 scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)

Also remove the few vim config lines that were left. We should either have them
on all files, or none.

Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-12 08:30:31 +02:00
Zbigniew Jędrzejewski-Szmek 408c9a07e5 test: filter out messages when stripping binaries
We would get an error for every script, which is just noise.
2019-04-12 08:23:41 +02:00
Yu Watanabe 02849d8b4f test-network: add tests for MACsec 2019-04-12 10:12:42 +09:00
Yu Watanabe b0e13c3122 network: add MACsecTransmitAssociation.UseForEncoding= setting 2019-04-12 10:12:42 +09:00
Yu Watanabe a7b9c52f1f network: add MACsec*Association.Activate= setting 2019-04-12 10:12:42 +09:00
Yu Watanabe eb4705fb36 network: add MACsec*Association.KeyFile= setting 2019-04-12 10:12:42 +09:00
Susant Sahani 81962db798 network: Introduce MACsec
Media Access Control Security (MACsec) is an 802.1AE IEEE
industry-standard security technology that provides secure
communication for all traffic on Ethernet links.
MACsec provides point-to-point security on Ethernet links between
directly connected nodes and is capable of identifying and preventing
most security threats, including denial of service, intrusion,
man-in-the-middle, masquerading, passive wiretapping, and playback attacks.

Closes #5754
2019-04-12 10:12:41 +09:00
Lennart Poettering 54f802ff8a
Merge pull request #12037 from poettering/oom-state
add cgroupv2 oom killer event handling to service management
2019-04-11 18:57:47 +02:00
Lennart Poettering 574ef404d8
Merge pull request #12279 from keszybz/sd-bus-long-signatures
sd-bus: properly handle messages with overlong signatures
2019-04-11 17:03:57 +02:00
Zbigniew Jędrzejewski-Szmek f0ae945ecc bus-message: validate signature in gvariant messages
We would accept a message with 40k signature and spend a lot of time iterating
over the nested arrays. Let's just reject it early, as we do for !gvariant
messages.
2019-04-11 14:01:38 +02:00
Yu Watanabe 8b0f4bac72 test: make directory for drop-in config
Follow-up for a2fbac5875.
2019-04-11 09:58:47 +02:00
Zbigniew Jędrzejewski-Szmek 4ddff52640
Merge pull request #12270 from yuwata/test-set-longer-timeout
test: set longer timeout
2019-04-11 08:31:14 +02:00
Yu Watanabe a2fbac5875 test: set longer watchdog timeout for timedated 2019-04-11 03:25:08 +09:00
Yu Watanabe 70f3336e96 test: set longer timeout for 'udevadm control' 2019-04-11 02:27:15 +09:00
Yu Watanabe 86a3d44de5 network: fix use-of-uninitialized-value or null dereference
This fixes a bug introduced by 6ef5c881dd.

Fixes oss-fuzz#14157 and oss-fuzz#14158.
2019-04-10 18:18:11 +09:00
Lennart Poettering 36869f3381 test: add test case for new OOM logic 2019-04-09 11:17:58 +02:00
Zbigniew Jędrzejewski-Szmek 52efbd8f0e
Merge pull request #12223 from yuwata/network-wireguard-preshared-key-file
network: add PresharedKeyFile= setting and make reading key file failure fatal
2019-04-09 10:52:52 +02:00
Yu Watanabe 9e5d79e7a1 test-network: add tests for WireGuardPeer.PresharedKey= and PresharedKeyFile= 2019-04-09 15:50:23 +09:00
Yu Watanabe a3945c6361 network: add WireGuardPeer.PresharedKeyFile= setting 2019-04-09 15:50:22 +09:00
Yu Watanabe cb31e7c861 network: make reading PrivateKeyFile= failure always fatal
This also refactor wireguard_read_key_file().
2019-04-09 15:50:22 +09:00
Yu Watanabe daa4aca1cb calendarspec: fix possible integer overflow
Fixes oss-fuzz#14108.
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14108
2019-04-08 00:50:07 +09:00
Zbigniew Jędrzejewski-Szmek 6c34ed5111 test: use newer verb to set log levels 2019-04-03 08:19:08 +02:00
Lennart Poettering f69567cbe2 core: expose SUID/SGID restriction as new unit setting RestrictSUIDSGID= 2019-04-02 16:56:48 +02:00
Zbigniew Jędrzejewski-Szmek 237ebf61e2
Merge pull request #12013 from yuwata/fix-switchroot-11997
core: on switching root do not emit device state change based on enumeration results
2019-04-02 16:06:07 +02:00
Lennart Poettering 347da10194 test: add tests for new .timer units 2019-04-02 08:20:10 +02:00
Yu Watanabe dd09a9ec0f
Merge pull request #12160 from yuwata/wait-online-allow-configuring
wait-online: add --any option
2019-04-02 06:10:36 +09:00
Yu Watanabe 03db80b2d1 test-network: add tests for --any option of wait-online 2019-04-02 03:38:22 +09:00
Yu Watanabe c7f070bd4a test-network: fix timeout argument for wait_online() 2019-04-02 03:38:22 +09:00
Yu Watanabe 4b6a6d1e37 test-network: add tests for FooOverUDP tunnels 2019-04-02 03:29:46 +09:00
Yu Watanabe 38f4bb4428 test-network: add more tests for SerializeTunneledPackets=, Key=, and friends 2019-04-02 03:07:08 +09:00
Yu Watanabe 546c203d83 test: set longer StartLimitIntervalSec= and fewer StartLimitBurst=
Some test environment may be in heavy load. In that case, rate limit
never hit, and the test fails...
2019-04-01 19:13:36 +02:00
Yu Watanabe 753e0a2446 test-network: add test for NetDev.Name= conflict 2019-04-01 10:30:31 +09:00
Yu Watanabe 5a0bd90b82 test-network: add test for drop-in [WireGuardPeer] section
This also merges the two wireguard tests, and use wait_online()
to speed up the test.
2019-04-01 10:30:30 +09:00
Yu Watanabe b07b19dff8
Merge pull request #12147 from yuwata/network-gre-key-12144
network: make GRE and GRETAP support Key= or friends
2019-03-31 22:12:34 +09:00
Yu Watanabe 6730a1f343 test-network: test stacked erspan tunnels 2019-03-30 21:17:53 +09:00
Yu Watanabe 0ef830cf54 test-network: merge tests for [Route] section 2019-03-30 02:27:22 +09:00
Yu Watanabe a15ff207df test-network: use wait_online() in test_sysctl_disable_ipv6() 2019-03-30 02:27:22 +09:00
Yu Watanabe ba1e0d0612 test-network: use wait_online() in test_sysctl()
This also disables IPv6AcceptRA= to speed up the test.
2019-03-30 02:27:22 +09:00
Yu Watanabe 2dcfcc08d9 test-network: use wait_online() in test_link_local_addressing()
This also disables IPv6AcceptRA= to speed up the test.
2019-03-30 02:27:22 +09:00
Yu Watanabe d06f30fc73 test-network: fix addr_gen_mode
If stable_secret is set, then networkd sets addr_gen_mode 2.
2019-03-30 02:27:22 +09:00
Yu Watanabe c2990ec39a test-network: move tests related to bonding 2019-03-30 02:27:22 +09:00
Yu Watanabe b810272594 test-network: merge tests about static addresses
And use wait_online()
2019-03-30 02:27:22 +09:00
Yu Watanabe 5aa58329d8 test-network: add wait_online() helper function 2019-03-30 02:27:16 +09:00
Lennart Poettering f087c7e072 test: add some basic testing that "systemctl start -T" does something 2019-03-27 12:37:37 +01:00
Yu Watanabe 4d6cd572a7 fuzz: add testcases for the bug in condition_free_list_type() 2019-03-24 00:35:39 +09:00
Zbigniew Jędrzejewski-Szmek b2645747b7 nspawn-oci: fix double free
Also rename function to make it clear that it also frees the array
object itself.
2019-03-22 17:39:12 +01:00
Zbigniew Jędrzejewski-Szmek b1f13b0e75 nspawn-oci: mount source is optional 2019-03-22 12:04:32 +01:00