Lennart Poettering [Fri, 19 Oct 2018 08:48:41 +0000 (10:48 +0200)]
Merge pull request #10457 from yuwata/fuzz-11019
sd-dhcp: fixes oss-fuzz#11019 and several cleanups
Evgeny Vereshchagin [Thu, 18 Oct 2018 05:47:26 +0000 (05:47 +0000)]
core: stop ignoring errors in connect_logger_as
When journald reaches the maximum number of active streams, it,
basically, starts to decline new connections. On the client
side it can be detected by getting EPIPE and, if the writing
process isn't lucky enough, getting SIGPIPE soon afterwards.
systemd has always ignored EPIPE, which makes it very hard
to keep track of services losing logs. This patch should make
it easier to detect such services by just staring at the logs
carefully.
In case anyone is interested, the following one-liner run as any user
can be used to paralyze all the stream logging on a machine:
for i in {1..4096}; do systemd-cat -t HEY-$i & done
Lennart Poettering [Fri, 19 Oct 2018 08:12:00 +0000 (10:12 +0200)]
Merge pull request #10460 from yuwata/setsockopt_int-more
tree-wide: use setsockopt_int() more
Lennart Poettering [Fri, 19 Oct 2018 00:04:12 +0000 (02:04 +0200)]
core: beautify per-unit consumed resources log message a bit. (#10390)
Shorten message to say "no IP traffic" if there is no IP traffic, rather
than "received 0B IP traffic, sent 0B IP traffic".
Fixes: #9816
Yu Watanabe [Thu, 18 Oct 2018 23:57:51 +0000 (08:57 +0900)]
Merge pull request #10437 from poettering/env-util-love
some env-util.c love
Yu Watanabe [Thu, 18 Oct 2018 23:48:37 +0000 (08:48 +0900)]
Merge pull request #10389 from poettering/nspawn-path-fix
nspawn $PATH execvpe() fix
Yu Watanabe [Thu, 18 Oct 2018 23:44:51 +0000 (08:44 +0900)]
Merge pull request #10450 from poettering/foreach-line-excorcism
FOREACH_LINE excorcism
Yu Watanabe [Thu, 18 Oct 2018 23:36:01 +0000 (08:36 +0900)]
Merge pull request #10447 from poettering/fgets-excorcism
let's get rid of fgets()
Yu Watanabe [Thu, 18 Oct 2018 21:11:49 +0000 (06:11 +0900)]
sd-dhcp6: drop empty 'error' label
Yu Watanabe [Thu, 18 Oct 2018 19:59:18 +0000 (04:59 +0900)]
test-dhcp6-client: normalize logs
Yu Watanabe [Thu, 18 Oct 2018 18:45:46 +0000 (03:45 +0900)]
fuzz: add testcase of oss-fuzz#11019
Yu Watanabe [Thu, 18 Oct 2018 18:42:10 +0000 (03:42 +0900)]
sd-dhcp6: make dhcp6_option_parse_domainname() not store empty domain
This improves performance of fuzzer.
C.f. oss-fuzz#11019.
Yu Watanabe [Thu, 18 Oct 2018 18:40:30 +0000 (03:40 +0900)]
sd-dhcp6: do not update serverid when ENOMEM
Yu Watanabe [Thu, 18 Oct 2018 18:38:59 +0000 (03:38 +0900)]
sd-dhcp6: coding style cleanups
Yu Watanabe [Thu, 18 Oct 2018 18:44:56 +0000 (03:44 +0900)]
sd-dhcp6: fix argument and error handling of dhcp6_option_parse_status()
Yu Watanabe [Thu, 18 Oct 2018 21:03:19 +0000 (06:03 +0900)]
resolved-mdns: use TAKE_FD()
Yu Watanabe [Thu, 18 Oct 2018 20:58:03 +0000 (05:58 +0900)]
resolved-llmnr: use TAKE_FD()
Yu Watanabe [Thu, 18 Oct 2018 20:39:55 +0000 (05:39 +0900)]
tree-wide: use setsockopt_int() more
Lennart Poettering [Thu, 18 Oct 2018 19:53:01 +0000 (21:53 +0200)]
Merge pull request #10456 from poettering/setsockopt-int
add a setsockopt_int() helper and make use of it everywhere
Lennart Poettering [Thu, 18 Oct 2018 18:59:24 +0000 (20:59 +0200)]
tests: clean up again after running tests (#10446)
Currently, if I run the full "run-integration-tests.sh" script it will
fail on my machine because it fills up /var/tmp whith just too much
crap until the disk is full.
Let's make sure that "run-integration-tests.sh" cleans up after every
test. For that change the make targets to run from "clean setup run" to
"clean setup run clean" — except that that doesn't work since make is
smart enough to realize that the same target appears twice on the
command line and will only execute it once. Let's fix that by defining
another target "clean-again" which is just like "clean", but allows us
to be added to the same command line a second time. Then, let's build
with "clean setup run clean-again" and all is good.
While we are at it, let's also add .PHONY where appropriate, after all
these all are phony targets.
Lennart Poettering [Thu, 18 Oct 2018 18:55:30 +0000 (20:55 +0200)]
job: add a comment that JOB_DONE also means skipped due to condition (#10453)
Lennart Poettering [Thu, 18 Oct 2018 17:49:18 +0000 (19:49 +0200)]
util: drop const_int_one/const_int_zero again
There's only a single user remaining now that we have setsockopt_int(),
let's define those variables locally.
This more or less reverts
6d5e65f6454212cd400d0ebda34978a9f20cc26a.
Lennart Poettering [Thu, 18 Oct 2018 17:48:18 +0000 (19:48 +0200)]
tree-wide: introduce setsockopt_int() helper and make use of it everywhere
As suggested by @heftig:
https://github.com/systemd/systemd/commit/
6d5e65f6454212cd400d0ebda34978a9f20cc26a#commitcomment-
30938667
Lennart Poettering [Thu, 18 Oct 2018 15:10:42 +0000 (17:10 +0200)]
efi: rework OFFSETOF() based on __builtin_offsetof()
Since both LLVM and gcc supported this for a long time, we are not
adding a fallback compat kludge. And even if there's some relevant
compiler that doesn't know this concept, it'll fail with a compiler
error, and we'll fix it then.
As suggested by @keszybz:
https://github.com/systemd/systemd/pull/10174#discussion_r226266540
Lennart Poettering [Thu, 18 Oct 2018 16:30:38 +0000 (18:30 +0200)]
Merge pull request #10239 from yuwata/sd-device-monitor
sd-device: introduce sd_device_monitor
Lennart Poettering [Thu, 18 Oct 2018 16:05:58 +0000 (18:05 +0200)]
Merge pull request #10407 from yuwata/netlink-slot
sd-netlink: introduce sd_netlink_slot object and relevant functions
Lennart Poettering [Sat, 13 Oct 2018 11:12:56 +0000 (13:12 +0200)]
test: check for putenv() failures, the call might theortically fail
Lennart Poettering [Sat, 13 Oct 2018 11:12:32 +0000 (13:12 +0200)]
exec-util: errors are reported by non-zero, not negative by putenv()
Lennart Poettering [Sat, 13 Oct 2018 11:11:32 +0000 (13:11 +0200)]
nspawn: use container $PATH (not host $PATH) when searching for PID 1 binaries to execute
Fixes: #10377
Zbigniew Jędrzejewski-Szmek [Thu, 18 Oct 2018 11:46:01 +0000 (13:46 +0200)]
mkosi: use Fedora 29
F29 is at beta now, but should be out within two or three weeks, by the time
next systemd release happens.
Lennart Poettering [Thu, 18 Oct 2018 14:21:05 +0000 (16:21 +0200)]
tmpfiles: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:20:43 +0000 (16:20 +0200)]
sysv-generator: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:18:52 +0000 (16:18 +0200)]
sysusers: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:18:35 +0000 (16:18 +0200)]
install: pass encountered error number to log_syntax()
Lennart Poettering [Thu, 18 Oct 2018 14:18:20 +0000 (16:18 +0200)]
install: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:18:01 +0000 (16:18 +0200)]
clean-ipc: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:17:23 +0000 (16:17 +0200)]
resolved-resolv-conf: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:16:52 +0000 (16:16 +0200)]
resolved-etc-hosts: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:16:06 +0000 (16:16 +0200)]
resolved-dns-trust-anchor: FOREACH_LINE excorcism
Also, properly ignore these read errors, and say so.
Lennart Poettering [Thu, 18 Oct 2018 14:15:35 +0000 (16:15 +0200)]
localectl: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:15:18 +0000 (16:15 +0200)]
sd-path: FOREACH_LINE exorcism
Lennart Poettering [Thu, 18 Oct 2018 14:14:59 +0000 (16:14 +0200)]
bus-creds: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:14:42 +0000 (16:14 +0200)]
coredump: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:14:25 +0000 (16:14 +0200)]
smack-setup: include error cause in log message
Lennart Poettering [Thu, 18 Oct 2018 14:14:12 +0000 (16:14 +0200)]
smcak-setup: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:12:40 +0000 (16:12 +0200)]
shutdown: FOREACH_LINE() excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:12:06 +0000 (16:12 +0200)]
ima-setup: prefer safe_close() over plain close()
Lennart Poettering [Thu, 18 Oct 2018 14:11:54 +0000 (16:11 +0200)]
ima-setup: include error cause in failure messages
Lennart Poettering [Thu, 18 Oct 2018 14:10:37 +0000 (16:10 +0200)]
ima-setup: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:09:53 +0000 (16:09 +0200)]
cgroup: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:09:19 +0000 (16:09 +0200)]
time-util: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:08:51 +0000 (16:08 +0200)]
process-util: FOREACH_LINE excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:08:30 +0000 (16:08 +0200)]
mount-util: FOREACH_LINE() excorcism
Lennart Poettering [Thu, 18 Oct 2018 14:08:13 +0000 (16:08 +0200)]
cgroup-util: FOREACH_LINE() excorcism
Zbigniew Jędrzejewski-Szmek [Thu, 18 Oct 2018 14:06:01 +0000 (16:06 +0200)]
Merge pull request #10174 from poettering/sd-boot-counter-efi
the EFI changes from PR #9437 (the boot counting PR)
Yu Watanabe [Thu, 18 Oct 2018 08:50:25 +0000 (17:50 +0900)]
bus-unit-util: use streq() instead of STR_IN_SET()
Follow-up for
90fc172e191f44979005a524521112f2bd1ff21b (#10308).
Lennart Poettering [Thu, 18 Oct 2018 11:41:09 +0000 (13:41 +0200)]
udev-rules: fgets() excorcism
Lennart Poettering [Thu, 18 Oct 2018 11:40:55 +0000 (13:40 +0200)]
condition: fgets() excorcism
Lennart Poettering [Thu, 18 Oct 2018 11:40:39 +0000 (13:40 +0200)]
reply-password: fgets() excorcism
Lennart Poettering [Thu, 18 Oct 2018 11:40:21 +0000 (13:40 +0200)]
modules-load: fgets() excorcism
Lennart Poettering [Thu, 18 Oct 2018 11:40:03 +0000 (13:40 +0200)]
keymap-util: fgets() excorcism
Lennart Poettering [Thu, 18 Oct 2018 11:39:41 +0000 (13:39 +0200)]
hwdb: fgets() excorcism
Lennart Poettering [Thu, 18 Oct 2018 11:39:29 +0000 (13:39 +0200)]
catalog: fgets() excorcism
Lennart Poettering [Thu, 18 Oct 2018 11:34:40 +0000 (13:34 +0200)]
cryptsetup-generator: fgets() excorcism
Lennart Poettering [Thu, 18 Oct 2018 11:34:12 +0000 (13:34 +0200)]
cgtop: fgets() excorcism
Lennart Poettering [Thu, 18 Oct 2018 11:33:19 +0000 (13:33 +0200)]
binfmt: fgets() excorcism
Also, let's not claim we ignored errors when we don't.
Lennart Poettering [Thu, 18 Oct 2018 11:33:00 +0000 (13:33 +0200)]
binfmt: validate rule file name before using it
Lennart Poettering [Thu, 18 Oct 2018 11:32:34 +0000 (13:32 +0200)]
terminal-util: use fgetc() carefully instead of fread()
Lennart Poettering [Thu, 18 Oct 2018 11:32:05 +0000 (13:32 +0200)]
terminal-util: excorcise fgets()
Lennart Poettering [Thu, 18 Oct 2018 11:30:20 +0000 (13:30 +0200)]
clock-util: excorcise fgets()
Michael Biebl [Wed, 17 Oct 2018 22:56:41 +0000 (00:56 +0200)]
docs: use h2 headers
The primer theme does not add a mouse-over anchor link for h1 headers.
So use h2 for subsection headers which looks nicer anyway.
Followup for #10421
Anita Zhang [Mon, 8 Oct 2018 03:28:36 +0000 (20:28 -0700)]
core: implement per unit journal rate limiting
Add LogRateLimitIntervalSec= and LogRateLimitBurst= options for
services. If provided, these values get passed to the journald
client context, and those values are used in the rate limiting
function in the journal over the the journald.conf values.
Part of #10230
Yu Watanabe [Tue, 16 Oct 2018 17:32:26 +0000 (02:32 +0900)]
resolve: set IP_RECVERR
Closes #10345.
Yu Watanabe [Wed, 17 Oct 2018 21:20:41 +0000 (06:20 +0900)]
Merge pull request #10438 from poettering/path-is-valid
be a bit more carful when processing transient socket paths via the bus
Lennart Poettering [Wed, 17 Oct 2018 20:55:00 +0000 (22:55 +0200)]
Merge pull request #10439 from poettering/job-struct-init
three trivial simplifications/clean-ups
Lennart Poettering [Wed, 17 Oct 2018 20:54:34 +0000 (22:54 +0200)]
Merge pull request #10440 from poettering/fflush-and-check-some-more
use fflush_and_check() and free_and_replace() where we can
Lennart Poettering [Wed, 17 Oct 2018 19:29:10 +0000 (21:29 +0200)]
Merge pull request #10428 from keszybz/failure-actions
Implement manager status changes using SuccessAction=
Lennart Poettering [Wed, 17 Oct 2018 18:18:27 +0000 (20:18 +0200)]
service: use free_and_replace() where we can
Lennart Poettering [Wed, 17 Oct 2018 18:14:51 +0000 (20:14 +0200)]
exec-util: use fflush_and_check() where appropriate
Lennart Poettering [Wed, 17 Oct 2018 18:13:54 +0000 (20:13 +0200)]
execute: shorten things a bit
Lennart Poettering [Wed, 17 Oct 2018 18:16:52 +0000 (20:16 +0200)]
job: add lots of colons to log messages
Lennart Poettering [Wed, 17 Oct 2018 17:07:15 +0000 (19:07 +0200)]
job: use structured initialization
Lennart Poettering [Wed, 17 Oct 2018 19:06:23 +0000 (21:06 +0200)]
core: use structured initialization
Lennart Poettering [Wed, 17 Oct 2018 19:06:09 +0000 (21:06 +0200)]
core: shorten list appending a bit, by using better macros
Lennart Poettering [Wed, 17 Oct 2018 19:00:16 +0000 (21:00 +0200)]
dbus: add missing OOM check
Lennart Poettering [Wed, 17 Oct 2018 16:28:43 +0000 (18:28 +0200)]
core: validate socket path with path_is_valid()
Lennart Poettering [Wed, 17 Oct 2018 16:28:14 +0000 (18:28 +0200)]
path-util: add new path_is_valid() helper
Lennart Poettering [Wed, 17 Oct 2018 19:05:33 +0000 (21:05 +0200)]
list: fix double avaluation in LIST_APPEND()
Lennart Poettering [Wed, 17 Oct 2018 14:27:20 +0000 (16:27 +0200)]
env-util: drop ARG_MAX define
It's not a constant, hence don't pretend it was.
Lennart Poettering [Wed, 17 Oct 2018 18:12:35 +0000 (20:12 +0200)]
env-util: modernize strv_env_set() a bit
Lennart Poettering [Wed, 17 Oct 2018 18:11:52 +0000 (20:11 +0200)]
env-util: modernize strv_env_replace()
Lennart Poettering [Wed, 17 Oct 2018 18:10:09 +0000 (20:10 +0200)]
env-util: rework strv_env_merge()
Let's clean up the failure codepaths, by using _cleanup_.
This relies on the new behaviour of env_append() introduced in the
previous commit that guarantess the list always remains properly NULL
terminated
Lennart Poettering [Wed, 17 Oct 2018 18:08:42 +0000 (20:08 +0200)]
env-util: rework env_append()
Let's make sure the strv we are putting together always remains valid
(i.e. is NULL terminated). Also document the parameters to pass in
correctly.
Lennart Poettering [Wed, 17 Oct 2018 12:41:14 +0000 (14:41 +0200)]
env-util: use strv_contains() where appropriate
Lennart Poettering [Wed, 17 Oct 2018 13:58:25 +0000 (15:58 +0200)]
man: mention µs
Andreas Henriksson [Sun, 14 Oct 2018 12:53:09 +0000 (14:53 +0200)]
sulogin-shell: Use force if SYSTEMD_SULOGIN_FORCE set
When the root account is locked sulogin will either inform you of
this and not allow you in or if --force is used it will hand
you passwordless root (if using a recent enough version of util-linux).
Not being allowed a shell is ofcourse inconvenient, but at the same
time handing out passwordless root unconditionally is probably not
a good idea everywhere.
This patch thus allows to control which behaviour you want by
setting the SYSTEMD_SULOGIN_FORCE environment variable to true
or false to control the behaviour, eg. via adding this to
'systemctl edit rescue.service' (or emergency.service):
[Service]
Environment=SYSTEMD_SULOGIN_FORCE=1
Distributions who used locked root accounts and want the passwordless
behaviour could thus simply drop in the override file in
/etc/systemd/system/rescue.service.d/override.conf
Fixes: #7115
Addresses: https://bugs.debian.org/802211
Zbigniew Jędrzejewski-Szmek [Wed, 17 Oct 2018 15:27:20 +0000 (17:27 +0200)]
core: do not "warn" about mundane emergency actions
For example in a container we'd log:
Oct 17 17:01:10 rawhide systemd[1]: Started Power-Off.
Oct 17 17:01:10 rawhide systemd[1]: Forcibly powering off: unit succeeded
Oct 17 17:01:10 rawhide systemd[1]: Reached target Power-Off.
Oct 17 17:01:10 rawhide systemd[1]: Shutting down.
and on the console we'd write (in red)
[ !! ] Forcibly powering off: unit succeeded
This is not useful in any way, and the fact that we're calling an "emergency action"
is an internal implementation detail. Let's log about c-a-d and the watchdog actions
only.
Zbigniew Jędrzejewski-Szmek [Tue, 16 Oct 2018 14:34:45 +0000 (16:34 +0200)]
units: allow and use SuccessAction=exit-force in system systemd-exit.service
C.f.
287419c119ef961db487a281162ab037eba70c61: 'systemctl exit 42' can be
used to set an exit value and pulls in exit.target, which pulls in systemd-exit.service,
which calls org.fdo.Manager.Exit, which calls method_exit(), which sets the objective
to MANAGER_EXIT. Allow the same to happen through SuccessAction=exit.
v2: update for 'exit' and 'exit-force'
Zbigniew Jędrzejewski-Szmek [Tue, 16 Oct 2018 13:34:57 +0000 (15:34 +0200)]
units: use SuccessAction=poweroff-force in systemd-poweroff.service
Explicit systemctl calls remain in systemd-halt.service and the system
systemd-exit.service. To convert systemd-halt, we'd need to add
SuccessAction=halt-force. Halting doesn't make much sense, so let's just
leave that is. systemd-exit.service will be converted in the next commit.
Zbigniew Jędrzejewski-Szmek [Tue, 16 Oct 2018 13:30:53 +0000 (15:30 +0200)]
units: use SuccessAction=reboot-force in systemd-reboot.service