1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00
Commit Graph

32845 Commits

Author SHA1 Message Date
Mike Gilbert
2156061fb3 cg_unified_cached: return ENOMEDIUM if we cannot find a known hierarchy
When the test suite is being run in a foreign environment,
/sys/fs/cgroup might not be set up in a way that we recognize.
Returning ENOMEDIUM causes the tests to be skipped in this case.

Bug: https://bugs.gentoo.org/771819
2021-03-17 15:42:22 +01:00
Yu Watanabe
fa92d38428 dhcp6: fix wrong length for IA_PD dhcp6 option
Fixes an issue introduced by 73b49d433c.

When PrefixDelegationHint= is not set, dhcp6_option_append_pd() sets
wrong length for IA_PD option, as `r` is `-EINVAL`.

Fixes #19021.
2021-03-16 21:29:49 +01:00
Lennart Poettering
69bedd07c3
Merge pull request #19009 from poettering/one-more-cname-fix
resolved: more CNAME redirect fixes
2021-03-16 21:29:06 +01:00
Lennart Poettering
d977ef2542 journald: restore syslog priority *with* facility bits for stream connections when restarting journald
Fixes: #19019
2021-03-16 16:09:47 +01:00
Lennart Poettering
d267ac6e64 journald: use log_warning_errno() where appropriate 2021-03-16 16:07:42 +01:00
Yu Watanabe
efd3be9de1 sd-event: re-check new epoll events when a child event is queued
Previously, when a process outputs something and exit just after
epoll_wait() but before process_child(), then the IO event is ignored
even if the IO event has higher priority. See #18190.

This can be solved by checking epoll event again after process_child().

However, there exists a possibility that another process outputs and
exits just after process_child() but before the second epoll_wait().
When the IO event has lower priority than the child event, still IO
event is processed.

So, this makes new epoll events and child events are checked in a loop
until no new event is detected. To prevent an infinite loop, the number
of maximum trial is set to 10.

Fixes #18190.
2021-03-16 13:35:20 +01:00
Lennart Poettering
b1eea703e0 resolved: don't flush answer RRs on CNAME redirect too early
When doing a CNAME/DNAME redirect let's first check if the answer we
already have fully answers the redirected question already. If so, let's
use that. If not, let's properly restart things.

This simply removes one call to dns_answer_reset() that was placed too
early: instead of resetting when we detect a CNAME/DNAME redirect, do so
only after checking if the answer we already have doesn't match the
reply, and then decide to *actually* follow it. Or in other words: rely
on the dns_answer_reset() call in dns_query_go() which we'll call to
actually begin with the redirected question.

This fixes an optimization path which was broken back in 7820b320ea.

(This doesn't really matter as much as one might think, since our cache
stepped in anyway and answered the questions before going back to the
network. However, this adds noise if RRs with very short TTLs are cached
– which some CDNs do – and is of course relavant when people turn off
the local cache.)
2021-03-15 23:55:07 +01:00
Lennart Poettering
a7c0291c10 resolved: match CNAME replies to right question
Previously by mistake we'd always match every single reply we get in a
CNAME chain to the original question from the stub client. That's
broken, we need to test it against the CNAME query we are currently
looking at.

The effect of this incorrect matching was that we'd assign the RRs to
the wrong section since we'd assume they'd be auxiliary answers instead
of primary answers.

Fixes: #18972
2021-03-15 23:54:53 +01:00
Lennart Poettering
1414b67e0d resolved: add helper for dumping DnsQuestion, similar to what we have for DnsAnswer 2021-03-15 23:41:25 +01:00
Lennart Poettering
567aa5c87b resolved: show TTLs in answer dump 2021-03-15 23:41:25 +01:00
Lennart Poettering
c4d98c3acc resolved: use DNS_ANSWER_MASK_SECTIONS where appropriate 2021-03-15 23:41:25 +01:00
Lennart Poettering
a1acc6e332 resolved: let's tweak how we calculate TTL left
When responding from DNS cache, let's slightly tweak how the TTL is
lowered: as before let's round down when converting from our internal µs
to the external seconds. (This is preferable, since records should
better be cached too short instead of too long.) Let's avoid rounding
down to zero though, since that has special semantics in many cases (in
particular mDNS). Let's just use 1s in that case.
2021-03-15 23:41:25 +01:00
Lennart Poettering
b974211acb resolved: take shortest TTL of all of RRs in answer as cache lifetime
We nowadays cache full answer RRset combinations instead of just the
exact matching rrset. This means we should not cache RRs that are not
immediate answers to our question for longer then their own RRs. Or in
other words: let's determine the shortest TTL of all RRs in the whole
answer, and use that as cache lifetime.
2021-03-15 22:57:40 +01:00
Lennart Poettering
f6d80c361d resolved: drop unnecessary local variable 2021-03-15 21:21:43 +01:00
Lennart Poettering
b12058e8f9 resolved: fix indentation 2021-03-15 21:21:42 +01:00
Lennart Poettering
77db3caee3 resolved: use dns_answer_isempty() where appropriate 2021-03-15 21:21:42 +01:00
Lennart Poettering
3b7006cb44 resolved: rebreak a few comments 2021-03-15 21:21:42 +01:00
Lennart Poettering
1499a0a99a resolved: add new helper dns_answer_min_ttl() 2021-03-15 21:21:37 +01:00
Luca Boccassi
65d325edb8
Merge pull request #18984 from poettering/event-test-timeout
sd-event: add test for timeout parameter of sd_event_wait()
2021-03-15 14:31:48 +00:00
Daan De Meyer
95ba433a5f boot: Move console declarations to missing_efi.h
These were added to eficonex.h in gnu-efi 3.0.13. Let's move them
to missing_efi.h behind an appropriate guard to fix the build with
recent versions of gnu-efi.
2021-03-13 13:13:54 +00:00
Yu Watanabe
925bd4c24e fstab-util: fix typo in comment 2021-03-13 12:26:10 +01:00
Kevin Backhouse
37ca78a35c ask-password-api: fix error handling on invalid unicode character
The integer overflow happens when utf8_encoded_valid_unichar() returns an error
code. The error code is a negative number: -22. This overflows when it is
assigned to `z` (type `size_t`). This can cause an infinite loop if the value
of `q` is 22 or larger.

To reproduce the bug, you need to run `systemd-ask-password` and enter an
invalid unicode character, followed by a backspace character.

GHSL-2021-052
2021-03-12 18:25:58 +01:00
Lennart Poettering
7cb45dbfa3 sd-event: fix error handling
Noticed by @keszybz, see #18973
2021-03-12 17:56:56 +01:00
Lennart Poettering
c14e57ba6b sd-event: add a simple test for checking the timeout parameter of sd_event_wait()
Related to: #18973
2021-03-12 17:56:33 +01:00
Frantisek Sumsal
cb72605436 Revert "sd-event: re-check new epoll events when a child event is queued"
This reverts commit 84e998c112.

Temporarily revert this commit, since it breaks CI.
2021-03-11 18:57:43 +01:00
Yu Watanabe
84e998c112 sd-event: re-check new epoll events when a child event is queued
Previously, when a process outputs something and exit just after
epoll_wait() but before process_child(), then the IO event is ignored
even if the IO event has higher priority. See #18190.

This can be solved by checking epoll event again after process_child().

However, there exists a possibility that another process outputs and
exits just after process_child() but before the second epoll_wait().
When the IO event has lower priority than the child event, still IO
event is processed.

So, this makes new epoll events and child events are checked in a loop
until no new event is detected. To prevent an infinite loop, the number
of maximum trial is set to 10.

Fixes #18190.
2021-03-11 23:09:04 +09:00
Yu Watanabe
7fe11e84c2 test: add log messages 2021-03-11 23:09:04 +09:00
Zbigniew Jędrzejewski-Szmek
47d1cae6cf
Merge pull request #18915 from keszybz/reexec-bug
Fix crash during daemon-reexec with systemd-oomd running
2021-03-11 14:46:16 +01:00
Zbigniew Jędrzejewski-Szmek
eb406c4e19
Merge pull request #18955 from keszybz/fstab-escaping
Fix handling of escaped characters in fstab
2021-03-11 14:45:11 +01:00
Zbigniew Jędrzejewski-Szmek
e4645ca599 basic/group-util: optimize alloca use
Follow-up for 0fa7b50053.
2021-03-11 14:43:16 +01:00
Frantisek Sumsal
3a1bc3fcc0 repart: fix the loop dev support check
Since f17bdf8264 the test-repart was
effectively disabled, since `/dev/loop-control` is a character special
file, whereas `-f` works only on regular files. Even though we could use
`-c` to check specifically for character special files, let's use `-e`
just in case.
2021-03-11 14:42:33 +01:00
Zbigniew Jędrzejewski-Szmek
ceffd6a961
Merge pull request #18962 from poettering/dissect-fixes
three image dissection fixes
2021-03-11 14:42:17 +01:00
Michal Sekletar
43b4e3058c install: refactor find_symlinks() and don't search for symlinks recursively
After all we are only interested in symlinks either in top-level config
directory or in .wants and .requires sub-directories.

As a bonus this should speed up ListUnitFiles() roughly 3-4x on systems
with a lot of units that use drop-ins (e.g. SSH jump hosts with a lot of
user session scopes).
2021-03-11 13:12:37 +01:00
Lennart Poettering
38db55ab0c dissect: fix trivial typo 2021-03-11 11:49:19 +01:00
Lennart Poettering
334eb5b099 dissect-image: fix volatile images
This makes sure nspawn's --volatile=yes switch works again: there we
have a read-only image that is overmounted by a tmpfs (with the
exception of /usr). This we need to mkdir all mount points even though
the image is read-only.

Hence, let's drop the optimizatio of avoiding mkdir() on images that are
read-only, it's wrong and misleading here, since the image itself might
be read-only but our mounts are not.
2021-03-11 11:48:31 +01:00
Lennart Poettering
9842905ede dissect-image: clean up meaning of DISSECT_IMAGE_MKDIR
Previously handling of DISSECT_IMAGE_MKDIR was pretty weird and broken:
it would control both if we create the top-level mount point when
mounting an image, and the inner mount points for images that consist of
multiple file systems. However, the latter is redundant, since
1f0f82f131 does this too, a few lines
further up – unconditionally!

Hence, let's make the meaning of DISSECT_IMAGE_MKDIR more strict: it
shall be only about the top-level mount point, not about the inner ones
(where we'll continue to create what is missing alwayway). Having a
separate flag for the top-level mount point is relevant, since the mount
point dir created by it will remain on the host fs – unlike the
directories we create inside the image, which will stay within the
image.

This slightly change of meaning is actually inline with what the flag is
actually used for and documented in systemd-dissect.
2021-03-11 11:48:31 +01:00
Zbigniew Jędrzejewski-Szmek
d6cef552dc fstab-generator: get rid of fstab_extract_values()
This was a parallel implementation of option parsing that didn't
support escaping of separators. Let's port this over to the common code.

Fixes #18952.
2021-03-11 11:25:15 +01:00
Zbigniew Jędrzejewski-Szmek
ff0c31bc27 shared/fstab-util: teach fstab_filter_options() a mode where all values are returned
Apart from tests, the new argument isn't used anywhere, so there should be no
functional change. Note that the two arms of the big conditional are switched, so the
diff is artificially inflated. The actual code change is rather small. I dropped the
path which extracts ret_value manually, because it wasn't supporting unescaping of the
escape character properly.
2021-03-11 11:25:15 +01:00
Zbigniew Jędrzejewski-Szmek
0264b404b9 shared/fstab-util: pass through the escape character
… when not used to escape the separator (,) or the escape character (\).
This mostly restores behaviour from before 0645b83a40,
but still allows "," to be escaped.

Partially fixes #18952.
2021-03-11 11:25:06 +01:00
Zbigniew Jędrzejewski-Szmek
3141089f53 basic/extract-word: rename flag
The flag enables "relaxed mode" for all kinds of unescaping, not just c-unescaping.
2021-03-11 09:21:07 +01:00
Zbigniew Jędrzejewski-Szmek
76c4e48ee6 basic/extract-word: allow escape character to be escaped
With EXTRACT_UNESCAPE_SEPARATORS, backslash is used to escape the separator.
But it wasn't possible to insert the backslash itself. Let's allow this and
add test.
2021-03-11 09:21:07 +01:00
Zbigniew Jędrzejewski-Szmek
8723c716c7 basic/extract_word: try to explain what the various options do
A test for stripping of escaped backslashes without any flags was explicitly
added back in 4034a06ddb. So it seems to be on
purpose, though I would say that this is at least surprising and hence deserves
a comment.

In test-extract-word, add tests for standalone EXTRACT_UNESCAPE_SEPARATORS.
Only behaviour combined with EXTRACT_CUNESCAPE was tested.
2021-03-11 09:21:04 +01:00
Zbigniew Jędrzejewski-Szmek
5fa2da1251 shared/fstab-util: immediately drop empty options again
In the conversion from strv_split() to strv_split_full() done in
7bb553bb98, EXTRACT_DONT_COALESCE_SEPARATORS was
added. I think this was just by mistake… We never look for "empty options", so
whether we immediately ignore the extra separator or store the empty string in
strv, should make no difference.
2021-03-11 09:19:54 +01:00
Zbigniew Jędrzejewski-Szmek
924f650305 generators: warn but ignore failure to write timeouts
When we failed to split the options (because of disallowed quoting syntax, which
might be a bug in its own), we would silently fail. Instead, let's emit a warning.
Since we ignore the value if we cannot parse it anyway, let's ignore this error
too.
2021-03-11 09:19:00 +01:00
Lennart Poettering
48f813c4aa coredumpctl: fflush() stdout before invoking gdb
Fixes: #18936
2021-03-11 08:55:20 +01:00
Frantisek Sumsal
a174da59c2 coredump: omit coredump info when -q is used with the debug verb
Skip printing the coredump info table when using the `debug` verb in
combination with the `-q/--quiet` option. Useful when trying to gather
coredump info non-interactively via scripted gdb commands.

Fixes: systemd/systemd#18935
2021-03-10 17:35:21 +01:00
Zbigniew Jędrzejewski-Szmek
1677b88d01 fstab-generator: do not propagate error if we fail to canonicalize
r is used for the return value of the function, so we shouldn't
use it a non-fatal check.
2021-03-10 16:54:18 +01:00
Zbigniew Jędrzejewski-Szmek
749c4c8ed1
Merge pull request #18553 from Werkov/cgroup-user-instance-controllers
Make (user) instance aware of delegated cgroup controllers
2021-03-10 09:41:40 +01:00
Zbigniew Jędrzejewski-Szmek
ffea01856f
Merge pull request #18942 from keszybz/sd-netlink-prettification
sd-nelink prettification
2021-03-10 09:18:06 +01:00
Lennart Poettering
e5f8ce13bb socket-util: refuse ifnames with embedded '%' as invalid
So Linux has this (insane — in my opinion) "feature" that if you name a
network interface "foo%d" then it will automatically look for the
interface starting with "foo…" with the lowest number that is not used
yet and allocates that.

We should never clash with this "magic" handling of ifnames, hence
refuse this, since otherwise we never know what the name is we end up
with.

We should probably switch things from a deny list to an allow list
sooner or later and be much stricter. Since the kernel directly enforces
only very few rules on the names, we'd need to do some research what is
safe and what is not first, though.
2021-03-10 11:11:52 +09:00