Commit Graph
4080 Commits
Author SHA1 Message Date
Arthur Shau 1bd0b9c053 varlink: Add new varlink_collect method
varlink_collect is meant to be used when the client is willing to wait for the reply from the varlink method, much like varlink_call.
However, unlike varlink_call, it allows the client to collect all "more" replies that may be sent by method before the "final" reply is enqueued.
It aggregates all of these replies into a json variant array that it returns to the client.
2023-10-19 11:52:09 +02:00
Yu Watanabe ffee7b97e3 macro: introduce u64_multiply_safe() to avoid overflow
Just a paranoia.
2023-10-19 18:31:44 +09:00
Yu Watanabe 2977904cad macro: introduce several helper functions for alignment
Some of them are not used in this commit, but will be used later.
2023-10-19 18:31:44 +09:00
Lennart Poettering 81c1c387fe Merge pull request #29594 from poettering/cgroup-rename-ret-params
more pidfdification
2023-10-18 17:25:44 +02:00
Lennart Poettering d0547385d9 test-cgroup: make test case a bit more robust towards previous aborted runs 2023-10-18 14:49:40 +02:00
Lennart Poettering 957f84e950 test: port tests over to new /proc/ enumeration API 2023-10-18 14:49:40 +02:00
Lennart Poettering 4d9f092b5e process-util: add pidref_is_unwaited() and make pid_is_unwaited() return errors 2023-10-18 14:49:40 +02:00
Lennart Poettering becdfcb9f1 process-util: change pid_is_alive() to not eat up errors, and add pidref_is_alive()
Let's no eat up errors, but propagate unexpected ones.
2023-10-18 14:40:25 +02:00
Lennart Poettering 8b51341545 process-util: add pidref_get_uid() and rename get_process_uid() → pidref_get_uid() 2023-10-18 14:39:33 +02:00
Lennart Poettering d7d748548b process-util: add pidref_get_comm() and rename get_process_comm() to pid_get_comm() 2023-10-18 14:39:33 +02:00
Lennart Poettering fc87713bed process-util: add pidref_is_kernel_thread() 2023-10-18 14:39:33 +02:00
Lennart Poettering a034620f1a process-util: add pidref_get_cmdline() 2023-10-18 14:39:33 +02:00
Lennart Poettering c2e42d4b88 serialize: change order of deserialize_strv() parameters
The other deserializers put value first, and return parameter second,
let's do so here too.
2023-10-18 12:54:20 +02:00
Lennart Poettering a104481144 cgroup: turn device cgroup controller "rwm" strings into proper flags
We generally prefer dealing with parsed data instead of original
strings, do so for the "rwm" strings too. We have to convert this to
flags for the primary backend implementation (BPF) anyway, hence we
can do this early to have simpler, shorter and more normalized code.
2023-10-17 23:27:01 +01:00
Zbigniew Jędrzejewski-Szmek 386256e699 test: make sure that the default naming scheme name maps back to itself
We were testing the that C constant is defined, but we weren't actually testing
that the string name maps back to itself. This would catch the issue fixed by
the grandparent commit.

The test for the default name is moved to the test file to keep the tests
together. The define is renamed to not have "_TEST" in the name. The issue here
is complicated by the fact that we allow downstreams to inject additional
fields, so we don't know the name of the default scheme if it not set with
-Ddefault-net-naming-scheme=, so _DEFAULT_NET_NAMING_SCHEME[_TEST] is not
defined in all cases, but at least in principle it could be used in other
places. If it exists, it is fully valid.
2023-10-16 21:21:54 +02:00
Lennart Poettering f5151fb459 sysext: make some calls available via varlink 2023-10-16 12:08:39 +02:00
Jan Janssen ec9d3fc51c test: Remove unnecessary test prefix 2023-10-15 12:10:37 +01: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
Luca Boccassi ccba67f494 Merge pull request #27890 from bluca/executor
core: add systemd-executor binary
2023-10-13 22:01:16 +01:00
Lennart Poettering 5d2ea9b5cf test: add simple test for two common kind of errors 2023-10-12 15:28:06 +02:00
Luca Boccassi 81b913f076 serialize: add open_serialization_file() 2023-10-12 13:37:22 +01:00
Luca Boccassi 1b30ccd81b serialize: add serialize_string_set() 2023-10-12 13:37:22 +01:00
Luca Boccassi 6dae20ec41 serialize: add serialize_item_base64mem() 2023-10-12 13:37:22 +01:00
Luca Boccassi 3f12c5ff2e serialize: add serialize_item_hexmem() 2023-10-12 13:37:22 +01:00
Lennart Poettering 98d8c37595 Merge pull request #29427 from ddstreet/cryptenroll_specify_handle_index
Cryptenroll specify handle index
2023-10-11 10:47:01 +02:00
Lennart Poettering 79d956db34 namespace: make setup_namespace() less crazy
Let's replace the ridiculous number of arguments with a structure, to
make this function less weird.

No change in behaviour, just some refactoring.
2023-10-11 12:39:30 +09:00
Dan Streetman adcd3266ec test: add tests for systemd-cryptenroll --tpm2-seal-key-handle
In TEST-70-TPM2, test systemd-cryptenroll --tpm2-seal-key-handle using the
default (0) as well as the SRK handle (0x81000001), and test using a non-SRK
handle index after creating and persisting a primary key.

In test/test-tpm2, test tpm2_seal() and tpm2_unseal() using default (0), the SRK
handle, and a transient handle.
2023-10-10 05:56:45 -04:00
Lennart Poettering 94f0b13b16 cgroup: rename TasksMax structure to CGroupTasksMax
Almost all our enums/structs/funcs carry the CGroup prefix if they are
defined in cgroup.h, TasksMax so far does not, even though it is
exclusively used in cgroup context.

Change that.
2023-10-06 18:13:16 +02:00
Lennart Poettering 4e16d5c69e pcrextend: make pcrextend tool acccessible via varlink
This is primarily supposed to be a 1st step with varlinkifying our
various command line tools, and excercise in how this might look like
across our codebase one day. However, at AllSystemsGo! 2023 it was
requested that we provide an API to do a PCR measurement along with a
matching event log record, and this provides that.
2023-10-06 11:49:38 +02:00
Lennart Poettering faec54ad34 test: add test for varlink introspection logic 2023-10-06 11:49:38 +02:00
Lennart Poettering 2c07d314b2 fileio: revamp search_and_fopen()
Let's modernize and clean up search_and_fopen a bit: let's add support
for regular open() (instead of fopen()), as well as access() (if caller
just wants to check if a file exists without opening it.

This unifies much of the code involved, which previously was duplicated
in search_and_fopen() and search_and_fopen_nulstr()
2023-10-05 19:01:28 +02:00
Lennart Poettering bd1791b597 cgroup-util: drop "controller" argument from various cgroup helper calls
systemd's own cgroup hierarchy is special to us, we use it to actually
manage processes. Because of that many calls tha apply to cgroups are
only ever called with the SYSTEMD_CGROUP_CONTROLLER as controller
argument. Let's hence remove the argument altogether.

This in particular touches the kill and xattr routines.

This changes no behaviour, we just drop an argument that is always set
to the same value anyway.

This is preparation to eventually getting rid of the cgroupvs1, because
on cgroupvs2 the cgroup paths do not change for different controllers,
there's only a single hierarchy there.
2023-10-05 11:11:04 +02:00
Daan De Meyer 180d5aeaa7 Merge pull request #29403 from yuwata/journal-decouple-journald-and-journal-remote
journal: drop ManagedJournalFile and decouple journald and journal-remote
2023-10-04 07:55:52 +02:00
Yu Watanabe fcdd21ec6a tree-wide: fix typo 2023-10-04 08:58:10 +09:00
Dan Streetman 171d5b69c0 tpm2: update tpm2 test for supported commands
The test expects TPM2_CC_FIRST - 1 and TPM2_CC_LAST + 1 to be unsupported, but
those are not necessarily invalid commands. Instead test known-invalid
commands. Also add some more valid commands.
2023-10-03 12:56:55 -04:00
Zbigniew Jędrzejewski-Szmek db5d86f5b9 test-loopback: suppress warning about ignored unused result 2023-10-03 17:19:07 +01:00
Luca Boccassi fdb0b47bf7 Merge pull request #29407 from CM4all/test-kernel-acl-dummy
src/test: fixups for kernels without ACL and net-dummy
2023-10-02 16:30:39 +01:00
Max Kellermann 8a87a16bbb test/test-execute: skip PrivateNetwork tests if kernel has no dummy netdevice support 2023-10-02 15:32:04 +02:00
Max Kellermann ec757e920c test/test-chown-rec: skip ACL tests if kernel has no ACL support
The second half of `chown_recursive` works only if the kernel has ACL support.
2023-10-02 15:32:04 +02:00
Lennart Poettering 8d9a1d5979 dissect-image: optionally allow mounting via new kernel mount API in two steps
This adds support for the new fsmount() logic of the kernel: we'll first
create an unattached fsmount fd, and then in a second step attach this
to some real file system inode – as opposed to attaching file system
directly. The benefit of this is that we can pass the open fsmount fds
over some sockets if need be, to isolate the mounting code from the
attaching code.
2023-10-02 14:02:32 +01:00
Daan De Meyer 1e5e902f60 Merge pull request #29343 from DaanDeMeyer/tmp
Use a subdirectory of /run/systemd for PrivateDevices=
2023-10-02 14:29:32 +02:00
Daan De Meyer cd7f3702eb core: Use a subdirectory of /run/ for PrivateDevices=
When we're starting early boot services such as systemd-userdbd.service,
/tmp might not yet be mounted, so let's use a directory in /run instead
which is guaranteed to be available.
2023-10-02 12:23:13 +02:00
Yu Watanabe d287ece7f1 test: split test-tables into three
Let's drop dependency to libjournal_core and libudevd_core from
test-tables.
2023-10-02 10:52:45 +09:00
Daan De Meyer 4444564a95 Merge pull request #29193 from keszybz/path-util-adjustment
Make unit mangling follow paths
2023-09-29 11:33:12 +02:00
Daan De Meyer 10d14c872f Merge pull request #29241 from poettering/pidref-watch
pid1: move unit_watch_pid()/unit_unwatch_pid() logic over to PidRef
2023-09-29 11:32:19 +02:00
Lennart Poettering c407bfa68f test-watch-pid: use a real PID, not a made up one
This matters once we track processes with pidfds rather than just pid_t,
because made up PIDs likely won't exist.

The essence of the test remains unmodified, we just use a real, existing
PID instead of 4711.
2023-09-28 23:22:58 +02:00
Dan Streetman 8c2205bb1c openssl: add kdf_ss_derive()
Add function to perform KDF-SS ("concat" KDF).

While Openssl allows a digest, HMAC, or KMAC for the auxiliary function H, this
currently only allows using a digest for H.
2023-09-28 16:44:42 -04:00
Dan Streetman 779b80d803 openssl: add ecc_edch()
Add function to perform ECC EDCH.
2023-09-28 16:44:42 -04:00
Dan Streetman 58f215a0ac openssl: add openssl_cipher_many()
Add function to perform openssl cipher operations.
2023-09-28 16:44:42 -04:00
Dan Streetman a65a25bec7 openssl: add kdf_kb_hmac_derive()
Add function to perform key-based (KB) key derivation function (KDF) using
hash-based message authentication code (HMAC).

Also alphabetize openssl-util.c header list, and include string-util.h.
2023-09-28 16:44:42 -04:00