Commit Graph

71663 Commits

Author SHA1 Message Date
Mike Yuan
b412274fd0 shared/install: use FOREACH_ARRAY at one more place 2024-03-07 02:02:00 +08:00
Mike Yuan
b2751cf039 shared/install: use RET_GATHER more 2024-03-07 02:02:00 +08:00
Mike Yuan
7dfc71399d path-lookup: rename lookup_paths_free -> _done
This is stack-allocated, so update to match our usual rules.
2024-03-07 02:01:57 +08:00
Lennart Poettering
cf1c8cdb87 resolved: expose raw RR resolver via Varlink too
Now that we have an address, hostname, and service resolve, at the last
kind of resovler we expose over D-Bus also to Varlink.
2024-03-06 19:00:53 +01:00
Lennart Poettering
0fe9c5da02 resolved: move ResourceKey/ResourceRecord varlink types to generic Resolve interface
Let's define this in the generic interface and then import it into the
Monitor interface too.

This is preparation for adding an interface to resolve arbitrary RRs via
Varlink, which means we want the type in both interfaces.
2024-03-06 19:00:53 +01:00
Ronan Pigott
da920fe176 resolved: decrease mdns/llmnr priority for the reverse mapping domains
Previously all queries to the reverse mapping domains (in-addr.arpa and
ip6.arpa) were considered to be in-scope for mdns and llmnr at the same
priority as DNS. This caused sd-resolved to ignore NXDOMAIN responses
from dns in favor of lengthy timeouts.

This narrows the scope of mdns and llmnr so they are not invariably
considered as fallbacks for these domains. Now, mdns/llmnr on a link
will only be used as a fallback when there is no suitable DNS scope, and
when that link is DefaultRoute.
2024-03-06 18:57:36 +01:00
Lennart Poettering
74d142ff3a Merge pull request #30612 from AdrianVovk/sleep-freeze-user-seesions
Freeze user sessions for all types of sleep
2024-03-06 18:52:57 +01:00
Lennart Poettering
19c4dd17f9 Merge pull request #31592 from YHNdnzj/exit-cgroup-notify
core/service: two fixes for ExitType=cgroup
2024-03-06 18:38:51 +01:00
Yu Watanabe
3d1279af79 meson: add missing dependency to libdl
Follow-up for 1c20c9f4fc.

Fixes https://github.com/systemd/systemd/pull/31550#issuecomment-1980458377.
2024-03-06 17:24:03 +00:00
Luca Boccassi
9a6acbdc03 Merge pull request #31657 from mrc0mmand/test-execute-shenanigans
A couple of tweaks for test-execute
2024-03-06 17:22:39 +00:00
Daan De Meyer
083f4f8f20 Merge pull request #31656 from DaanDeMeyer/meson
meson: Remove version_h dependency from jinja2_cmdline
2024-03-06 16:20:13 +01:00
Frantisek Sumsal
7161af9612 ci: explicitly change oom-{score}-adj before running tests
For some reason root in GH actions is able to _decrease_ its oom score
even after dropping all capabilities (including CAP_SYS_RESOURCE), until
the oom score is changed explicitly after sudo:

$ systemd-detect-virt
microsoft
$ sudo su -
~# capsh --drop=all -- -c 'capsh --print; grep -H . /proc/self/oom*; choom -p $$ -n -101'
Current: =
Bounding set =
Ambient set =
Current IAB: !cap_chown,!cap_dac_override,!cap_dac_read_search,...,!cap_sys_resource,...,!cap_checkpoint_restore
Securebits: 00/0x0/1'b0
 secure-noroot: no (unlocked)
 secure-no-suid-fixup: no (unlocked)
 secure-keep-caps: no (unlocked)
 secure-no-ambient-raise: no (unlocked)
uid=0(root) euid=0(root)
gid=0(root)
groups=0(root)
Guessed mode: UNCERTAIN (0)
/proc/self/oom_adj:8
/proc/self/oom_score:1000
/proc/self/oom_score_adj:500
pid 22180's OOM score adjust value changed from 500 to -101
~# choom -p $$ -n 500
pid 22027's OOM score adjust value changed from 500 to 500
~# capsh --drop=all -- -c 'capsh --print; grep -H . /proc/self/oom*; choom -p $$ -n -101'
Current: =
Bounding set =
Ambient set =
...
uid=0(root) euid=0(root)
gid=0(root)
groups=0(root)
Guessed mode: UNCERTAIN (0)
/proc/self/oom_adj:8
/proc/self/oom_score:1000
/proc/self/oom_score_adj:500
choom: failed to set score adjust value: Permission denied

I have no idea what's going on, but it breaks
exec-oomscoreadjust-negative.service from test-execute when running
unprivileged.
2024-03-06 16:10:47 +01:00
Frantisek Sumsal
c538fecc61 ci: make the build dir accessible when running w/o privileges
Otherwise the unprivileged part of test-execute gets silently skipped:

/* test_run_tests_unprivileged */
Successfully forked off '(test-execute-unprivileged)' as PID 20998.
...
pin_callout_binary: build dir binary: /home/runner/work/systemd/systemd/build/systemd-executor
pin_callout_binary: open(/home/runner/work/systemd/systemd/build/systemd-executor)=-13
Failed to pin executor binary: No such file or directory
(test-execute-unprivileged): manager_new, skipping tests: No such file or directory
(test-execute-unprivileged) succeeded.
2024-03-06 16:10:47 +01:00
TobiPeterG
5ff20f638b boot: replace manual string manipulation with xasprintf 2024-03-06 15:07:26 +00:00
Unique-Usman
c742317274 Improve the formatting by adding AlignArrayOfStructures and setting it to Right(right justify) 2024-03-06 15:24:23 +01:00
Daan De Meyer
5c25f9dbc5 meson: Remove version_h dependency from jinja2_cmdline
version_h includes GIT_VERSION which only makes sense for C files
which aren't preprocessed by jinja2 so remove the argument.

The end result of this change is that the man pages are not recompiled
anymore every time GIT_VERSION changes.
2024-03-06 15:16:52 +01:00
Daan De Meyer
76940e0a04 Use VERSION_TAG instead of GIT_VERSION in kernel-install scripts
GIT_VERSION only makes sense for C files as it depends on C preprocessor
macro expansion now so let's use VERSION_TAG instead of GIT_VERSION
for the two remaining usages of GIT_VERSION that are not in C files.
2024-03-06 15:15:55 +01:00
Luca Boccassi
5e575e4d92 Merge pull request #31580 from poettering/resolved-naptr
resolved: properly decode NAPTR RRs
2024-03-06 14:14:11 +00:00
Luca Boccassi
ba6ec879bb Merge pull request #31621 from poettering/resolved-proxy-do
resolved: proxy upstream local requests to our stub with DO bit set
2024-03-06 13:55:14 +00:00
Lennart Poettering
d49dc7bbe7 string-util: allow taking SIZE_MAX as size to shorten to
This is useful for two reasons:

1. it addresses a potential overflow in a graceful way

2. Gives callers the ability to just pass SIZE_MAX for a NOP

Prompted by: #31341
2024-03-06 13:24:15 +00:00
Lennart Poettering
10d50d9eac udev: use strndupa_safe() rather than strndupa()
As per coding style, we don't use strndupa(), but strndupa_safe() only.

As a side-effect, this means musl folks can just drop this mess:

https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/systemd/systemd/0003-src-basic-missing.h-check-for-missing-strndupa.patch
2024-03-06 13:23:17 +00:00
Christian Wesselhoeft
da95494ca3 PORTABLE_SERVICES.md: Improve grammar 2024-03-06 10:02:38 +00:00
Zbigniew Jędrzejewski-Szmek
ec3cf73f30 meson/man: allow man pages to use multiple conditions
This way the man pages are installed only when the corresponding binary is
installed. The conditions in man pages and man/rules/meson.build are adjusted to
match the conditions for units in units/meson.build.
2024-03-06 09:55:01 +00:00
Luca Boccassi
4d34622d22 ukify: convert certificate to public key before embedding in .pcrpkey
Follow-up for 419b25ddca
2024-03-06 09:53:02 +00:00
Frantisek Sumsal
9990fe8257 Merge pull request #31642 from weblate/weblate-systemd-main
Translations update from Fedora Weblate
2024-03-06 10:40:41 +01:00
Frantisek Sumsal
4e5a7e1923 test: use 'ahost' instead of 'hosts' where applicable
As explained in [0] the 'hosts' database uses deprecated
gethostbyname2() which uses AF_INET6 instead of AF_UNSPEC for IPv6
lookups which is broken and makes the test fail with disabled IPv6.

[0] https://github.com/systemd/systemd/pull/28136#issuecomment-1974901039
2024-03-06 01:15:30 +00:00
Temuri Doghonadze
4c9837da42 po: Translated using Weblate (Georgian)
Currently translated at 100.0% (233 of 233 strings)

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ka/
Translation: systemd/main
2024-03-06 02:06:50 +01:00
Yuri Chornoivan
48e7ed190e po: Translated using Weblate (Ukrainian)
Currently translated at 100.0% (233 of 233 strings)

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/uk/
Translation: systemd/main
2024-03-06 02:06:50 +01:00
Göran Uddeborg
32a56fd81c po: Translated using Weblate (Swedish)
Currently translated at 100.0% (233 of 233 strings)

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sv/
Translation: systemd/main
2024-03-06 02:06:50 +01:00
Vasiliy Kovalev
a850ae7a9c hwdb: Add touchpad toggle mapping for Kvadra LE14U/LE15U
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
2024-03-05 22:08:09 +00:00
Mike Yuan
771bf2274a basic: remove spuriously doubled newline and leftover separator
Follow-up for 3fc72d5413
2024-03-06 03:29:12 +08:00
Daan De Meyer
1ec5c1409e Merge pull request #31550 from teknoraver/dlopen_compress
Dynamically load compression libraries
2024-03-05 20:16:19 +01:00
Daan De Meyer
674a9a010b Merge pull request #31640 from DaanDeMeyer/mkosi
Mkosi fixes
2024-03-05 20:13:00 +01:00
Frantisek Sumsal
75c8b98090 test: bump the timeout for test-execute subtests if running w/ QEMU
Bump the timeout for test-execute subtests if running with plain QEMU
(as part of TEST-02-UNITTESTS), since we might start hitting the default
2m timeout with some more involved subtests, especially when the AWS
region we're running in is under heavy load. I see this regularly in the
CentOS Stream 9 nightly cron job with exec-dynamicuser-statedir.service
which has a lot of ExecStart's.
2024-03-05 18:50:14 +00:00
Daan De Meyer
bb478caa86 mkosi: Use specifier to refer to the output directory
Otherwise the output directory cannot be configured by users.
2024-03-05 19:42:18 +01:00
Daan De Meyer
c00b17f6d3 mkosi: Allow users to configure the build and cache directory 2024-03-05 19:41:50 +01:00
Daan De Meyer
adbb0237c6 mkosi: Set minimum version
This will only be taken into account by newer mkosi versions but it'll
at least save some pain from running on a too old version.
2024-03-05 19:41:06 +01:00
Vishal Chillara Srinivas
d08566fad7 resolved: remove entry from cache when goodbye packet received
RFC6762 10.1 says that queriers receiving a Multicast DNS response with a TTL
of zero SHOULD record a TTL of 1 and then delete the record one second later.

Added a timer event to trigger a callback to clean-up the cache one second after
a goodbye packet is received. The callback also checks for any cache entries
expiring within the next one second and schedules follow-up cleanup callbacks
accordingly.
2024-03-05 19:00:03 +01:00
Adrian Vovk
91448cf050 NEWS: Add note about freezing user session changes
These changes have the potential to break suspend on systems with
proprietary NVIDIA drivers, so we should make a big NEWS entry about it
2024-03-05 12:12:37 -05:00
Adrian Vovk
a5b009d935 homework: Lock/Unlock: Freeze/Thaw user session
Whenever a home directory is in a locked state, accessing the files of
the home directory is extremely likely to cause the thread to hang. This
will put the session in a strange state, where some threads are hanging
due to file access and others are not hanging because they are not
trying to access any of the user's files.

This can lead to a whole slew of consequences. For example, imagine a
likely situation where the Wayland compositor is not hanging, but the
user's open apps are. Eventually, the compositor will detect that none
of the apps are responding to its pings, assume that they're frozen
(which they are), and kill them. The systemd user instance can end up in
a similarly confused state and start killing user services. In the worst
case, killing an app at an unexpected moment can lead to data loss.

The solution is to suspend execution of the whole user session by
freezing the user's slice.
2024-03-05 12:12:36 -05:00
Adrian Vovk
0b958bb3ee sleep: Always freeze user.slice
Previously, we'd only freeze user.slice in the case of s2h, because we
didn't want the user session to resume while systemd was transitioning
from suspend to hibernate.

This commit extends this freezing behavior to all sleep modes.

We also have an environment variable to disable the freezing behavior
outright. This is a necessary workaround for someone that has hooks
in /usr/lib/systemd/system-sleep/ which communicate with some
process running under user.slice, or if someone is using the proprietary
NVIDIA driver which breaks when user.slice is frozen (issue #27559)

Fixes #27559
2024-03-05 12:12:35 -05:00
Adrian Vovk
7483708131 bus-unit-util: Add utility to freeze/thaw units
This utility lets us freeze units, and then automatically thaw them
when via a _cleanup_ handler. For example, you can now write something
like:

```
_cleanup_(unit_freezer_thaw) UnitFreezer freezer = UNIT_FREEZER_NULL;
r = unit_freezer_freeze("myunit.service", &freezer);
if (r < 0)
    return r;
// Freeze is thawed once this scope ends
```

Aside from the basic _freeze and _thaw methods, there's also
_cancel and _restore. Cancel destroys the UnitFreezer without
thawing the unit. Restore creates a UnitFreezer without freezing it.
The idea of these two methods is that it allows the freeze/thaw to
be separated from each other (i.e. done in response to two separate
DBus method calls). For example:

```
_cleanup_(unit_freezer_thaw) UnitFreezer freezer = UNIT_FREEZER_NULL;
r = unit_freezer_freeze("myunit.service", &freezer);
if (r < 0)
    return r;
// Freeze is thawed once this scope ends

r = do_something()
if (r < 0)
    return r; // Freeze is thawed

unit_freezer_cancel(&freezer); // Thaw is canceled.
```

Then in another scope:
```
// Bring back a UnitFreezer object for the already-frozen service
_cleanup_(unit_freezer_thaw) UnitFreezer freezer = UNIT_FREEZER_NULL;
r = unit_freezer_restore("myunit.service", &freezer);
if (r < 0)
    return r;
// Freeze is thawed once this scope ends
```
2024-03-05 12:12:34 -05:00
Lennart Poettering
1761567641 resolved: properly decode NAPTR RRs
Fixes: #18126
2024-03-05 15:46:31 +01:00
Lennart Poettering
c6342e35b0 escape: teach octescape() to work with NUL terminated strings 2024-03-05 15:46:31 +01:00
Lennart Poettering
6399be223b resolved: make resolved authoritative in resolveing our local host name
This is a kinda a follow-up for ce266330fc: it
makes resolved authoritative on our local hostname, and never contacts
DNS anymore for it.

We effectively already were authoritative for it, except if the user
queried for other RR types than just A/AAAA. This closes the gap and
refuses routing other RR type queries to DNS.

Fixes: #23662
2024-03-05 15:31:32 +01:00
Lennart Poettering
4b91896226 resolved: make outselves authoritative for /etc/hosts entries in full
If you query for an MX RR of a host listed in /etc/hosts, let's return
an empty reply rather than NXDOMAIN, i.e. indicate that the name exists
but has no MX RR assigned, thus making ourselves authoritative.

The venerable "host" tool by default sends requests for A + AAAA + MX
and ensures we never propagate queries further on.

Fixes: #31223
2024-03-05 15:31:26 +01:00
Lennart Poettering
40008b83a0 resolved: rename variable found_{a|aaaa} → question_for_{a|aaaa}
Te variables indicate what kind of RRs we are looking for, but the name
so far suggests it was about what we already found. Let's rename the
variables to make the purpose clearer.
2024-03-05 15:31:02 +01:00
Lennart Poettering
8841d1cef8 resolved: do DNS RR type based routing
So far we only looked at the domain name when routing requests to
specific scopes. With this we'll also take the DNS RR type into account.
This takes benefit of the fact that lookups for RRs such as SOA or NS or
the various DNSSEC RR types never really make sense to be routed to
LLMNR or mDNS, since they don't have concepts there.

This hence refuses to route requests for those RR types to the
LLMNR/mDNS scopes, which hence means they'll likely be routed to classic
DNS instead.

This should improve behaviour of tools that assumes it speaks to classic
DNS only via 127.0.0.53, since it will now usually do that.
2024-03-05 15:29:25 +01:00
Lennart Poettering
df81adba88 ci: disable test that is now answered by knot
dig question with DNSSEC on will now be proxied upstream, i.e. to the
test knot server. This leads to different results, but the result isn't
tha tinteresting since we don't want to test knot, but resolved. Hence
comment this test.

There seems to be something wrong with the test though, as the upstream
server refused recursion, but if so it is not suitable as an upstream
server really, as resolved can only be client to a recursive resolver.
2024-03-05 15:29:19 +01:00
Lennart Poettering
9c47b33444 resolved: enable DNS proxy mode if client wants DNSSEC
So far we disabled DNSSEC if local clients asked for it via DO flag if
DNSSEC=no is set. Let's instead switch to proxy mode in this case, and
thus treat client requested DO mode as a way to force proxy mode.

This means DNSSEC=no just controls whether resolved will do validation
for regular looups, but it has no effect anymore on lookups from clients
that indicated they want to do their own DNSSEC anyway.

Fixes: #19227 #23737 #25105
2024-03-05 15:29:15 +01:00