Commit Graph
68280 Commits
Author SHA1 Message Date
Lennart Poettering f5e6f3117c Merge pull request #29548 from poettering/sysext-varlink
sysext: add a varlink IPC interface
2023-10-16 15:10:24 +02:00
Lennart Poettering 6c16c87baf Merge pull request #29562 from poettering/namespace-fuckup-fix
namespace: normalize memory management of mount list
2023-10-16 15:10:08 +02:00
Lennart Poettering 4d4c4ae9cb update TODO 2023-10-16 14:30:11 +02:00
Lennart Poettering 49a510eba2 run: pin the unit we invoke continously while we are running
We read properties of the unit, hence it shouldn't be GC'ed as long as
we run. Hence, let's just set AddRef unconditionally for the units we
create.
2023-10-16 14:30:11 +02:00
Lennart Poettering 7693661a84 run: output invocation ID when starting service and scope units 2023-10-16 14:30:11 +02:00
Lennart Poettering 7fcd134399 namespace: add // FIXME comments on some suplicate logging
@bluca thinks duplicate logging as a feature, hence simply mark these
log messages as // FIXME, but don't bother.
2023-10-16 13:35:36 +02:00
Lennart Poettering d4f0878e02 namespace: downgrade log messages to LOG_DEBUG
almost all code in namespace.c only logs at debug level as it is
"library-like" code. But there are some outliers. Adjust them to match
the rest of the code

(Well, there are some left)
2023-10-16 13:35:28 +02:00
Lennart Poettering 283eb4fdd1 namespace: don't retry to a mount if we didn't actually manage to create an inode 2023-10-16 13:18:03 +02:00
Lennart Poettering 3c36f7636c namespace: downgrade log message of error we ignore to LOG_WARNING
frankly, the log message shouldn't be there at all, but the error path
be propagated up, with a recognizable error code. But apparently this is
important to @bluca.
2023-10-16 13:17:59 +02:00
Lennart Poettering 3d1b999b53 namespace: convert ProtectHostname= logic to a static table
Let's simplify things, and make them more alike handling more similar to
the other ProtectXYZ= settings.
2023-10-16 13:12:48 +02:00
Daan De Meyer d6e5f170ef Add --json switch to udevadm info
This allows getting the udevadm info --export-db and query "all" output
as JSON.
2023-10-16 13:01:54 +02:00
Lennart Poettering 063c977a79 namespace: normalize memory management of mount list
So far we calculated exactly how many mounts we will generate, which is
a bit fragile, and easy to get wrong.

Let's normalize this, and grow the array of mounts as we need.

Various other modernizations while we are at it, such as FOREACH_ARRAY
usage, or `_cleanup_` usage.
2023-10-16 12:17:56 +02:00
Lennart Poettering dbf9e04591 update TODO 2023-10-16 12:08:40 +02:00
Lennart Poettering f5151fb459 sysext: make some calls available via varlink 2023-10-16 12:08:39 +02:00
Lukas c7fda70716 stub: NULL checks for DeviceHandle and FilePath
UKIs may be loaded in a way, that there can not be a device handle to
the filesystem, that contains the image, for example when using a
bootloader to load the image from a partition with a file system that is
not supported by the firmware.

With the current systemd stub, this causes a failed assertion, because
stub gets passed a NULL DeviceHandle and FilePath. Inserting two
explicit checks enables proper boot even in this case.

Fixes: #29331
2023-10-16 10:44:03 +02:00
Daan De Meyer 36d87065f2 Merge pull request #29558 from mrc0mmand/varlinkctl-tests
varlink: add a couple of tests + accompanying fixes
2023-10-16 09:49:42 +02:00
Vishal Chillara Srinivas 57cf92f741 resolve: fix no mDNS announcement after probing
According to RFC 6762 section 8, an mDNS responder is supposed to announce its
records after probing.
Currently, there is a check in dns_scope_announce which returns if there are any
pending transactions. This prevents announcements from being sent out even if there
are pending non-probe transactions.

To fix this, return only if there are active probe transactions.
2023-10-16 09:21:51 +02:00
Jan Janssen e9e40862de fuzz: Add fuzzer for efi conf/osrel parsing 2023-10-15 17:41:25 +02:00
Jan Janssen 5ce851ab99 boot: Fix OOB reads in conf/osrel parsing 2023-10-15 17:41:25 +02:00
Jan Janssen f17670a0c3 boot: Move line_get_key_value to efi-string
No functional changes.
2023-10-15 17:41:25 +02:00
Jan Janssen 539d000740 boot: Move parse_boolean to efi-string
No functional changes.
2023-10-15 17:41:25 +02:00
Jan Janssen ec9d3fc51c test: Remove unnecessary test prefix 2023-10-15 12:10:37 +01:00
Frantisek Sumsal abcf59970d core: don't downgrade multi-state settings to boolean
Protect{Home,System,Proc,Subset}= are not booleans, so make sure we use
the intended value instead of just true/false.

See: https://github.com/systemd/systemd/pull/29552
Follow-up to: 79d956d
2023-10-15 14:04:28 +08:00
Zbigniew Jędrzejewski-Szmek 80788a0bd4 shared/pretty-print: drop unused flag
0895e87348 removed the last (only?) use of
CAT_MAIN_FILE_OPTIONAL, except for tests. All callers first check if the main
file exists on their own, so this code was effectively dead.

I want to repopulate the enum in later commits, so a dummy flag is added
to allow the code to compile.
2023-10-14 18:36:10 +02:00
Frantisek Sumsal d04af6aaca docs: update fuzzers docs 2023-10-14 17:55:29 +02:00
Frantisek Sumsal 78ea6a549f test: update Ubuntu CI instructions 2023-10-14 17:40:07 +02:00
Frantisek Sumsal e97f2dfde4 varlink: drop dead code
'#' is never part of either allowed_chars or allowed_delimiters when we
parse structs/enums.
2023-10-14 17:40:07 +02:00
Frantisek Sumsal a972870ea2 varlink: use int for log level 2023-10-14 17:40:07 +02:00
Frantisek Sumsal 779e7b4410 varlink: don't panic on malformed method definition 2023-10-14 17:40:07 +02:00
Frantisek Sumsal 13de7c7e66 test: add a fuzzer for the varlink IDL stuff 2023-10-14 17:40:07 +02:00
Frantisek Sumsal 4b2391c4e3 test: add a couple of tests for varlinkctl 2023-10-14 17:40:07 +02:00
Luca Boccassi da638eb4c9 core: fix deserialization copypasta
CID#1522788
2023-10-14 11:26:57 +01:00
Mike Yuan 8d85efae91 core/exec-invoke: rename parameters of get_fixed_{user,group}
Follow-up for 1c9433559a

The user/group passed in could be either the name or the uid/gid.
2023-10-14 09:09:32 +01:00
Luca Boccassi edc85a02ec Merge pull request #29569 from YHNdnzj/foreach-array
core: use FOREACH_ARRAY more and some other minor changes
2023-10-14 09:08:40 +01:00
Luca Boccassi 0e3986bc1c Merge pull request #29525 from poettering/confext-sysext-multimodal
dissect: make sure we can dissect and inspect DDIs that are both confext *and* sysext
2023-10-14 00:28:47 +01:00
Mike Yuan 06120a1575 core: add MemoryKSM and SetLoginEnvironment to exec_context_dump 2023-10-14 06:41:02 +08:00
Mike Yuan 4520681da1 core/execute: correct alignment 2023-10-14 06:41:01 +08:00
Mike Yuan f7df8adb0c core/execute: use FOREACH_ARRAY more 2023-10-14 06:41:01 +08:00
Mike Yuan 1c2d424e45 core/execute-serialize: use FOREACH_ARRAY more 2023-10-14 06:35:23 +08:00
Lennart Poettering f2c96f0fd3 run: support --scope on old service managers that lack native PIDFD support
Before this we'd fail with a complaint that PIDFDs is not supported by
the service manager. Add some compat support by falling back to classic
numeric PIDs in that case.
2023-10-13 23:16:52 +01:00
Lennart Poettering 0e9f229769 update TODO 2023-10-14 00:01:59 +02:00
Luca Boccassi ccba67f494 Merge pull request #27890 from bluca/executor
core: add systemd-executor binary
2023-10-13 22:01:16 +01:00
Dan Streetman 0f1cb04f9a tpm: update comment on transient handle GetCapability bug in kernel tpm resource manager
Add clarification and link to kernel bug.
2023-10-13 22:17:18 +02:00
Nick Rosbrook 411d8c72ec nspawn: set CoredumpReceive=yes on container's scope when --boot is set
When --boot is set, and --keep-unit is not, set CoredumpReceive=yes on
the scope allocated for the container. When --keep-unit is set, nspawn
does not allocate the container's unit, so the existing unit needs to
configure this setting itself.

Since systemd-nspawn@.service sets --boot and --keep-unit, add
CoredumpReceives=yes to that unit.
2023-10-13 15:28:50 -04:00
Nick Rosbrook cfc015f09e man: document CoredumpReceive= setting 2023-10-13 15:28:50 -04:00
Nick Rosbrook a90f80c7e7 man: move NFTSec= entry to "Network Accouting and Control" section
Currently it is in the "Memory Pressure and Control" section, which does
not seem accurate.
2023-10-13 15:28:50 -04:00
Nick Rosbrook 097e28736a test: add a test for container support in coredump 2023-10-13 15:28:50 -04:00
Nick Rosbrook a108c43e36 coredump: add support for forwarding coredump to containers
If a process crashes within a container, try and forward the coredump to
that container. To do this, check if the crashing process is in a
different pidns, and if so, find the PID of the namespace leader. We
only proceed with forwarding if that PID belongs to a cgroup that is
descendant of another cgroup with user.delegate=1 and
user.coredump_receive=1 (i.e. Delegate=yes and CoredumpReceive=yes).

If we proceed, attach to the namespaces of the leader, and send the
coredump to systemd-coredump.socket in the container. Before this is
done, we need to translate the PID, UID, and GID, and also re-gather
procfs metadata. Translate the PID, UID, and GID to the perspective of
the container by sending an SCM_CREDENTIALS message over a socket pair
from the original systemd-coredump process, to the process forked in the
container.

If we cannot successfully forward the coredump, fallback to the current
behavior so that there is still a record of the crash on the host.
2023-10-13 15:13:11 -04:00
Nick Rosbrook ade39d9ab8 process-util: introduce namespace_get_leader helper
For a given PID and namespace type, this helper function gives the PID
of the leader of the namespace containing the given PID. Use this in
systemd-coredump instead of using the existing get_mount_namespace_leader.

This helper will be used again in a later commit.
2023-10-13 15:13:11 -04:00
Nick Rosbrook 9764bca98e coredump: store crashing process UID and GID in Context
For convenience, store the crashing process's UID and GID in Context (as
uid_t and gid_t, respectively), as is currently done for the PID. This
means we can just parse the UID/GID once in save_context(), and use
those values in other places.

This is just re-factoring, and is a preparation commit for container
support.
2023-10-13 15:13:11 -04:00