]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agoudevadm: actually set the log level 29862/head
Frantisek Sumsal [Sat, 4 Nov 2023 13:05:04 +0000 (14:05 +0100)] 
udevadm: actually set the log level

Follow-up to e4080a6d97.

2 years agoudevadm: make sure we don't reset max children on each invocation
Frantisek Sumsal [Sat, 4 Nov 2023 11:28:49 +0000 (12:28 +0100)] 
udevadm: make sure we don't reset max children on each invocation

Follow-up to e4080a6d97.

2 years agotree-wide: fix typo
Yu Watanabe [Sat, 4 Nov 2023 02:58:12 +0000 (11:58 +0900)] 
tree-wide: fix typo

2 years agotest: wait for the nvme device to appear
Frantisek Sumsal [Fri, 3 Nov 2023 14:31:52 +0000 (15:31 +0100)] 
test: wait for the nvme device to appear

Also, use a /dev/disk/by-id/ symlink to the device, which should be
predictable, unlike the /dev/nvmeX stuff.

2 years agoMerge pull request #29848 from poettering/base64url-too
Luca Boccassi [Fri, 3 Nov 2023 23:26:33 +0000 (23:26 +0000)] 
Merge pull request #29848 from poettering/base64url-too

hexdecoct: implicitly parse URL-safe base64 format, too

2 years agofuzz: limit the interface definition input size to 64K
Frantisek Sumsal [Fri, 3 Nov 2023 19:37:59 +0000 (20:37 +0100)] 
fuzz: limit the interface definition input size to 64K

To avoid timeouts with larger inputs.

Resolves: #29856

2 years agoUpdate NEWS
Luca Boccassi [Fri, 3 Nov 2023 20:50:48 +0000 (20:50 +0000)] 
Update NEWS

2 years agotest: add a couple of tests for systemd-bsod
Frantisek Sumsal [Fri, 6 Oct 2023 15:14:34 +0000 (17:14 +0200)] 
test: add a couple of tests for systemd-bsod

Add some basic tests for systemd-bsod, mainly to have something to build on
for #29056.

2 years agoRevert "test: don't panic on soft lockups"
Frantisek Sumsal [Fri, 3 Nov 2023 14:15:33 +0000 (15:15 +0100)] 
Revert "test: don't panic on soft lockups"

Let's put this back in, as it could help with occasional machine lock ups
on overloaded systems (and it didn't help with the original issue
anyway).

This reverts commit 3a89904e45cbbd96fb1c5d0768de5e5fcdaaa508.

2 years agoMerge pull request #29839 from goenkam/maanya/portabled_support_for_confext
Luca Boccassi [Fri, 3 Nov 2023 20:37:46 +0000 (20:37 +0000)] 
Merge pull request #29839 from goenkam/maanya/portabled_support_for_confext

portable: add support for confext

2 years agotest: add test for the combined base64/base64url decoder 29848/head
Lennart Poettering [Fri, 3 Nov 2023 20:34:45 +0000 (21:34 +0100)] 
test: add test for the combined base64/base64url decoder

2 years agohexdecoct: implicitly parse URL-safe base64 format, too
Lennart Poettering [Fri, 3 Nov 2023 13:07:39 +0000 (14:07 +0100)] 
hexdecoct: implicitly parse URL-safe base64 format, too

JSON-I (RFC 7493) suggests to use the URL safe base64 alphabet, rather
than the regular one when encoding binary data in JSON strings. We
generally uses the regular alphabet though.

Let's be tolerant in what we parse however: simply accept both formats
when we parse base64.

This does nothing about base64 generation though, only about parsing.

2 years agoMerge pull request #29847 from dtardon/udevadm-control-arg-processing
Luca Boccassi [Fri, 3 Nov 2023 20:34:53 +0000 (20:34 +0000)] 
Merge pull request #29847 from dtardon/udevadm-control-arg-processing

Streamline `udevadm control` arg. handling

2 years agocryptsetup: do not print (null) if pkcs11 uri not set
Antonio Alvarez Feijoo [Fri, 3 Nov 2023 15:28:14 +0000 (16:28 +0100)] 
cryptsetup: do not print (null) if pkcs11 uri not set

The pkcs11 uri is no set if the smart card is not inserted while using
`pkcs11-uri=auto` with libcryptsetup plugins.

```
> systemd-cryptsetup attach cr_data /dev/sda1 - pkcs11-uri=auto
Set cipher aes, mode xts-plain64, key size 512 bits for device /dev/sda1.
Security token (null) not present for unlocking volume Linux filesystem (cr_data), please plug it in.
```

2 years agoudev-ctrl: drop the unused maybe_disconnected stuff 29847/head
David Tardon [Fri, 3 Nov 2023 13:08:37 +0000 (14:08 +0100)] 
udev-ctrl: drop the unused maybe_disconnected stuff

2 years agoudevadm-control: return early if --exit is used
David Tardon [Fri, 3 Nov 2023 13:01:54 +0000 (14:01 +0100)] 
udevadm-control: return early if --exit is used

All the following commands would just fail with -ENOANO anyway, hence
there's no point in sending them. And it allows us to shave off some
error handling code.

2 years agoudevadm-control: parse all args in advance
David Tardon [Fri, 3 Nov 2023 12:12:42 +0000 (13:12 +0100)] 
udevadm-control: parse all args in advance

This is mostly just refactoring to make the code more manageable and
extendable. It doesn't introduce any semantic changes, but it
"optimizes" the communication with udevd a bit:
* If an option is used multiple times, only one command will be sent. If
  the option takes a value, the value of the final appearance of the
  option is used. The only exception is --property, which is additive by
  nature.
* Options --start-exec-queue and --stop-exec-queue are handled together.
  Only one of START_QUEUE/STOP_QUEUE commands will be sent to udevd even
  if both options appear on the command line.

2 years agoportable: add support for confext 29839/head
Maanya Goenka [Wed, 16 Aug 2023 18:43:06 +0000 (18:43 +0000)] 
portable: add support for confext

Support confexts for portable services

2 years agocore: check that extensions have the hierarchies before overlaying
Luca Boccassi [Wed, 1 Nov 2023 19:39:37 +0000 (19:39 +0000)] 
core: check that extensions have the hierarchies before overlaying

Before confext was added, hierarchies always existed in extensions. Now
they are optional - i.e., a sysext will not contain /etc/. So mixing a
confext and a sysext fails, as we'll try to create an overlay with /etc/
from the base, the confext and the sysext, but the latter doesn't have
the directory.

After the source images are mounted, check that each hierarchy exists in
each source image before creating the overlay, and drop them if they
don't.

Follow-up for 55ea4ef096543

2 years agostrv: add strv_free_many() to be used with CLEANUP_ARRAY()
Luca Boccassi [Fri, 3 Nov 2023 16:59:32 +0000 (16:59 +0000)] 
strv: add strv_free_many() to be used with CLEANUP_ARRAY()

2 years agoNEWS: add entry for vmspawn
Luca Boccassi [Fri, 3 Nov 2023 16:43:01 +0000 (16:43 +0000)] 
NEWS: add entry for vmspawn

2 years agoNEWS: fix typo and reword meson option entry
Luca Boccassi [Fri, 3 Nov 2023 16:13:20 +0000 (16:13 +0000)] 
NEWS: fix typo and reword meson option entry

2 years agoupdate NEWS
Lennart Poettering [Fri, 3 Nov 2023 16:40:33 +0000 (17:40 +0100)] 
update NEWS

2 years agonamespace: fix whitespace mixup
Lennart Poettering [Fri, 3 Nov 2023 16:27:41 +0000 (17:27 +0100)] 
namespace: fix whitespace mixup

2 years agomore additions to NEWS
Lennart Poettering [Fri, 3 Nov 2023 16:27:33 +0000 (17:27 +0100)] 
more additions to NEWS

2 years agoMerge pull request #28891 from poettering/pcrlock
Luca Boccassi [Fri, 3 Nov 2023 16:07:43 +0000 (16:07 +0000)] 
Merge pull request #28891 from poettering/pcrlock

new pcrlock tool for generating signed PCR policies for PCR 0, 1, 4, …

2 years agobsod: restore vt on SIGTERM/SIGINT
Frantisek Sumsal [Fri, 3 Nov 2023 10:05:30 +0000 (11:05 +0100)] 
bsod: restore vt on SIGTERM/SIGINT

Let's install a simple no-op signal handler without SA_RESTART for
SIGINT/SIGTERM, which allows us to interrupt read_one_char() and follow
it up with a proper cleanup, including restoring the vt to the original
state.

Resolves: #29478

2 years agovirt: also check if PID1 is in chroot
Yu Watanabe [Fri, 3 Nov 2023 05:29:59 +0000 (14:29 +0900)] 
virt: also check if PID1 is in chroot

In PID1, running_in_chroot() is called by safety_checks(), but without
this change, the check did nothing.

2 years agonspawn: allow disabling os-release check
Frantisek Sumsal [Fri, 3 Nov 2023 08:17:48 +0000 (09:17 +0100)] 
nspawn: allow disabling os-release check

Introduce a new env variable $SYSTEMD_NSPAWN_CHECK_OS_RELEASE, that can
be used to disable the os-release check for bootable OS trees. Useful
when trying to boot a container with empty /etc/ and bind-mounted /usr/.

Resolves: #29185

2 years agoMerge pull request #29508 from CodethinkLabs/systemd-vmspawn-pr
Luca Boccassi [Fri, 3 Nov 2023 16:04:38 +0000 (16:04 +0000)] 
Merge pull request #29508 from CodethinkLabs/systemd-vmspawn-pr

systemd-vmspawn implementation that only supports disk images

2 years agoMerge pull request #29840 from poettering/cryptsetup-tweaks-nore
Lennart Poettering [Fri, 3 Nov 2023 13:40:15 +0000 (14:40 +0100)] 
Merge pull request #29840 from poettering/cryptsetup-tweaks-nore

two cryptsetup bugfixes and some clean-ups

2 years agonspawn: fix two failure paths
Lennart Poettering [Fri, 3 Nov 2023 08:42:53 +0000 (09:42 +0100)] 
nspawn: fix two failure paths

We need to go to "finish" rather than just return.

All our exit paths got this right, except two.

2 years agoMerge pull request #29836 from poettering/libiptc-dlopen
Yu Watanabe [Fri, 3 Nov 2023 12:15:29 +0000 (21:15 +0900)] 
Merge pull request #29836 from poettering/libiptc-dlopen

make libiptc dep a dlopen() one

2 years agoupdate TODO
Lennart Poettering [Fri, 3 Nov 2023 11:14:38 +0000 (12:14 +0100)] 
update TODO

2 years agoMerge pull request #29827 from yuwata/network-install-default-configs
Lennart Poettering [Fri, 3 Nov 2023 10:37:04 +0000 (11:37 +0100)] 
Merge pull request #29827 from yuwata/network-install-default-configs

network: add meson option to install default configs

2 years agoupdate TODO 28891/head
Lennart Poettering [Mon, 23 Oct 2023 08:27:14 +0000 (10:27 +0200)] 
update TODO

2 years agotest: add pcrlock integration test
Lennart Poettering [Thu, 26 Oct 2023 11:52:06 +0000 (13:52 +0200)] 
test: add pcrlock integration test

(Contains various test additions added by @mrc0mmand)

2 years agoman: document pcrlock
Lennart Poettering [Wed, 25 Oct 2023 11:51:34 +0000 (13:51 +0200)] 
man: document pcrlock

2 years agounits: add units that put together and install a TPM2 PCR policy at boot
Lennart Poettering [Mon, 23 Oct 2023 10:02:53 +0000 (12:02 +0200)] 
units: add units that put together and install a TPM2 PCR policy at boot

(This is disabled by default, for now)

2 years agopcrlock: add pre-defined pcrlock files
Lennart Poettering [Wed, 16 Aug 2023 09:40:01 +0000 (11:40 +0200)] 
pcrlock: add pre-defined pcrlock files

These cover well-known measurements done by the UEFI firmware or
systemd.

2 years agotree-wide: hook everything up with pcrlock policy
Lennart Poettering [Tue, 24 Oct 2023 20:30:47 +0000 (22:30 +0200)] 
tree-wide: hook everything up with pcrlock policy

Make sure cryptenroll and repart can enroll TPM2 policies with pcrlock
logic.

Make sure cryptsetup can unlock TPM2 policies with pcrlock in effect.

2 years agopcrlock: add new pcrlock tool
Lennart Poettering [Wed, 16 Aug 2023 09:39:23 +0000 (11:39 +0200)] 
pcrlock: add new pcrlock tool

2 years agotpm2-util: add common array for TPM2 hash algorithms
Lennart Poettering [Mon, 23 Oct 2023 20:36:09 +0000 (22:36 +0200)] 
tpm2-util: add common array for TPM2 hash algorithms

This is useful to enumerate all hash algorithms we want to predict
measurements for.

2 years agotpm2-util: make various marshalling/unmarshalling calls static, as we only use them...
Lennart Poettering [Sat, 21 Oct 2023 14:34:28 +0000 (16:34 +0200)] 
tpm2-util: make various marshalling/unmarshalling calls static, as we only use them internally in tpm2-util.c

Note, some of these were just added in this same PR. We only exported
them initially to make sure gcc doesn't complained about unused local
symbols.

2 years agotpm2-util: add generic helpers for sealing/unsealing data
Lennart Poettering [Mon, 23 Oct 2023 08:30:25 +0000 (10:30 +0200)] 
tpm2-util: add generic helpers for sealing/unsealing data

These helpers tpm2_seal_data()/tpm2_unseal_data() are useful for
sealing/unsealing data without any further semantics around them. This
is different from the existing tpm2_seal()/tpm2_unseal() which seal with
a specific policy and serialize in a specific way, as we use it for disk
encryption.

These new helpers are more generic, they do not serialize in a specific
way or imply policy, they are just the core of the sealing/unsealing.

(We should look into porting tpm2_seal()/tpm2_unseal() onto these new
helpers, but this isn#t trivial, since the classic serialization we use
uses a merged marshalling of private/public key, which we'd have to
change in one way or another)

2 years agotpm2-util: add helper for creating/removing/updating NV index with stored policy
Lennart Poettering [Mon, 23 Oct 2023 08:28:59 +0000 (10:28 +0200)] 
tpm2-util: add helper for creating/removing/updating NV index with stored policy

This is the primary core of what pcrlock is supposed to do eventually:
maintain a TPM2 policy hash inside an NV index which we then can
reference via a PolicyAuthorizeNV expression to lock other objects
against it.

2 years agotpm2-util: add calls for calculating/submitting PolicyAuthorizeNV + PolicyOR TPM2...
Lennart Poettering [Thu, 19 Oct 2023 15:54:48 +0000 (17:54 +0200)] 
tpm2-util: add calls for calculating/submitting PolicyAuthorizeNV + PolicyOR TPM2 policies

2 years agotpm2-util: add helper that calculates name of NV index
Lennart Poettering [Thu, 19 Oct 2023 15:53:50 +0000 (17:53 +0200)] 
tpm2-util: add helper that calculates name of NV index

2 years agotpm2-util: add helper for setting TPM2B_AUTH in binary
Lennart Poettering [Thu, 19 Oct 2023 15:51:26 +0000 (17:51 +0200)] 
tpm2-util: add helper for setting TPM2B_AUTH in binary

2 years agotpm2-util: add helpers for marshalling NV index public areas
Lennart Poettering [Wed, 25 Oct 2023 08:55:51 +0000 (10:55 +0200)] 
tpm2-util: add helpers for marshalling NV index public areas

2 years agotpm2-util: add helpers for marshalling public/private keys
Lennart Poettering [Thu, 19 Oct 2023 15:50:39 +0000 (17:50 +0200)] 
tpm2-util: add helpers for marshalling public/private keys

Note: we export these new symbols for now. A later commit in this PR
will make them static again. The only reason they are exported here is
to make sure gcc doesn't complain about unused static symbols, and I
really wanted to commit them in a separate commit.

2 years agotpm2-util: export a couple of functions we'd like to use for pcrlock
Lennart Poettering [Thu, 19 Oct 2023 15:48:00 +0000 (17:48 +0200)] 
tpm2-util: export a couple of functions we'd like to use for pcrlock

2 years agotpm2-util: pick up a few new symbols from tpm2-tss
Lennart Poettering [Thu, 19 Oct 2023 15:44:48 +0000 (17:44 +0200)] 
tpm2-util: pick up a few new symbols from tpm2-tss

2 years agotpm2-util: add helper for returning path to EFI event log blob
Lennart Poettering [Thu, 31 Aug 2023 09:15:09 +0000 (11:15 +0200)] 
tpm2-util: add helper for returning path to EFI event log blob

2 years agotpm2-util: add various uefi event log definitions
Lennart Poettering [Thu, 13 Jul 2023 07:49:32 +0000 (09:49 +0200)] 
tpm2-util: add various uefi event log definitions

2 years agoefivars: add UEFI 'database' variable uuid
Lennart Poettering [Mon, 14 Aug 2023 11:18:18 +0000 (13:18 +0200)] 
efivars: add UEFI 'database' variable uuid

2 years agoman: mention DHCPv4 Router option is ignored when Classless Static Routes option...
Yu Watanabe [Fri, 3 Nov 2023 06:45:52 +0000 (15:45 +0900)] 
man: mention DHCPv4 Router option is ignored when Classless Static Routes option is received

For #29564.

2 years agocryptsetup: pass AskPasswordFlags down into pkcs11 module 29840/head
Lennart Poettering [Thu, 2 Nov 2023 21:32:36 +0000 (22:32 +0100)] 
cryptsetup: pass AskPasswordFlags down into pkcs11 module

The pkcs11 cryptsetup token module is a bit different from the tpm2 +
fido2 ones: it asks for the PIN itself, rather than bubbling up a
request to get a PIN. That's because it might need multiple, and because
we don't want to destroy a the pkcs11 session half-way and thus risk
increasing pin counters.

Hence, we sometimes ask for PINs from our code, rather than let the
libcryptsetup caller do that. So far we didn't pass the AskPasswordFlags
field down into the module though. Fix that.

Fixes: #28665
2 years agoupdate TODO 29836/head
Lennart Poettering [Thu, 2 Nov 2023 15:03:05 +0000 (16:03 +0100)] 
update TODO

2 years agofirewall: allow selecting firewall backend via env var
Lennart Poettering [Thu, 2 Nov 2023 14:58:50 +0000 (15:58 +0100)] 
firewall: allow selecting firewall backend via env var

2 years agofirewall: make sure firewall-util-private.h includes everythin it needs
Lennart Poettering [Thu, 2 Nov 2023 14:58:29 +0000 (15:58 +0100)] 
firewall: make sure firewall-util-private.h includes everythin it needs

2 years agofirewall: make libiptc dependency a dlopen() one
Lennart Poettering [Thu, 2 Nov 2023 14:57:10 +0000 (15:57 +0100)] 
firewall: make libiptc dependency a dlopen() one

2 years agodlfcn-util: add two new macros for making it easier to create "sym_xyz" indirect...
Lennart Poettering [Thu, 2 Nov 2023 14:53:40 +0000 (15:53 +0100)] 
dlfcn-util: add two new macros for making it easier to create "sym_xyz" indirect function call variables

Let's use "typeof" to make it easier to generate "sym_xyz" wrappers of
functions exposed by libraries.

2 years agoUpdate NEWS 29827/head
Yu Watanabe [Fri, 3 Nov 2023 02:53:50 +0000 (11:53 +0900)] 
Update NEWS

2 years agomeson: /etc/systemd/network is also used by udevd
Yu Watanabe [Thu, 2 Nov 2023 05:20:11 +0000 (14:20 +0900)] 
meson: /etc/systemd/network is also used by udevd

2 years agonetwork: add meson option to rename .example files on install
Yu Watanabe [Thu, 2 Nov 2023 05:12:42 +0000 (14:12 +0900)] 
network: add meson option to rename .example files on install

Also this renames 80-ethernet.network.example -> 89-ethernet.network.example,
to make it have lower precedence over other default .network files for
Ethernet interfaces.

Closes #29765.

2 years agoman: mention that network files should be prefixed with number smaller than 70
Yu Watanabe [Thu, 2 Nov 2023 05:18:16 +0000 (14:18 +0900)] 
man: mention that network files should be prefixed with number smaller than 70

2 years agonetwork: make generated configs have higher precedence over default configs
Yu Watanabe [Thu, 2 Nov 2023 04:41:30 +0000 (13:41 +0900)] 
network: make generated configs have higher precedence over default configs

We use 80- for default .network files. So, the generated files from the
kernel command line should have smaller prefix.

2 years agonetwork: disable IPv6AcceptRA= in several default config
Yu Watanabe [Thu, 2 Nov 2023 04:29:45 +0000 (13:29 +0900)] 
network: disable IPv6AcceptRA= in several default config

Also,
- drop DHCP=no, as it is the default setting,
- enable IPv6SendRA= for wifi access point,
- enable MulticastDNS= for wifi adhoc mode.

2 years agomeson: install newly added example .network file
Yu Watanabe [Thu, 2 Nov 2023 04:18:45 +0000 (13:18 +0900)] 
meson: install newly added example .network file

Follow-up for e6ba085398866ab05511fe748b8e9f7cbe85148e.

2 years agocryptsetup: disable activation via token plugin if we shall measure the volume key
Lennart Poettering [Thu, 2 Nov 2023 16:58:29 +0000 (17:58 +0100)] 
cryptsetup: disable activation via token plugin if we shall measure the volume key

if we allow cryptsetup to activate a volume via token plugin we never
get access to the volume key, which we'd like to measure. Hence disable
token plugins in that case.

(I tempted to say we probably should disable them entirely, and only use
them if classic cryptsetup is used, but that's a discussion for another
day.)

Fixes: #29790
2 years agocryptsetup: honour configured ask password flags also when activating via token
Lennart Poettering [Thu, 2 Nov 2023 16:56:47 +0000 (17:56 +0100)] 
cryptsetup: honour configured ask password flags also when activating via token

See: #28665 (this is not a fix for that PR though)

2 years agocryptsetup: rename usrptr to userdata
Lennart Poettering [Thu, 2 Nov 2023 16:56:16 +0000 (17:56 +0100)] 
cryptsetup: rename usrptr to userdata

Across our codebase we call the generic pointer "userdata", not
"userptr". Do so here too.

2 years agovarlink: limit the maximum nesting depth
Frantisek Sumsal [Thu, 2 Nov 2023 17:55:50 +0000 (18:55 +0100)] 
varlink: limit the maximum nesting depth

Let's limit the maximum nesting depth for structure definitions to 64 to
avoid stack overflows with very deep definitions.

Resolves: #29589

2 years agoMerge pull request #29792 from poettering/resolved-monitor-packet
Luca Boccassi [Thu, 2 Nov 2023 20:43:19 +0000 (20:43 +0000)] 
Merge pull request #29792 from poettering/resolved-monitor-packet

resolved: make sure "resolvectl monitor" can properly deal with stub …

2 years agocrytsetup: allow overriding the token .so library path via an env var
Lennart Poettering [Mon, 30 Oct 2023 21:26:09 +0000 (22:26 +0100)] 
crytsetup: allow overriding the token .so library path via an env var

I tried to get something similar upstream:

https://gitlab.com/cryptsetup/cryptsetup/-/issues/846

But no luck, it was suggested I use ELF interposition instead. Hence,
let's do so (but not via ugly LD_PRELOAD, but simply by overriding the
relevant symbol natively in our own code).

This makes debugging tokens a ton easier.

2 years agomeson: make sure we never actually link to libxenctrl
Lennart Poettering [Thu, 2 Nov 2023 14:57:34 +0000 (15:57 +0100)] 
meson: make sure we never actually link to libxenctrl

We don't make use of any of its symbols, we just want the headers, hence
make sure we never try to link against it.

2 years agotree-wide: never link directly against p11kit
Lennart Poettering [Thu, 2 Nov 2023 13:47:35 +0000 (14:47 +0100)] 
tree-wide: never link directly against p11kit

We go via dlopen() at most places, but forgot some. Cover the missing
cases too.

2 years agoMerge pull request #29748 from poettering/tgtmode
Luca Boccassi [Thu, 2 Nov 2023 17:26:05 +0000 (17:26 +0000)] 
Merge pull request #29748 from poettering/tgtmode

Storage target mode, inspired by "target disk mode" á la MacOS, but with NVMe-TCP

2 years agotest: check that `resolvectl monitor --json` generates valid JSON 29792/head
Frantisek Sumsal [Thu, 2 Nov 2023 17:08:30 +0000 (18:08 +0100)] 
test: check that `resolvectl monitor --json` generates valid JSON

Provides coverage for #29580.

2 years agovmspawn: created man page 29508/head
Sam Leonard [Thu, 12 Oct 2023 12:20:29 +0000 (13:20 +0100)] 
vmspawn: created man page

2 years agovmspawn: added initial code for vmspawn
Sam Leonard [Thu, 12 Oct 2023 12:13:19 +0000 (13:13 +0100)] 
vmspawn: added initial code for vmspawn

vmspawn-settings.c is currently empty but this will be used in future to
house code for parsing settings from a file

2 years agostring-util: add on_off
Sam Leonard [Thu, 2 Nov 2023 11:43:05 +0000 (11:43 +0000)] 
string-util: add on_off

2 years agonspawn: moved nspawn-creds.[ch] to shared/machine-credential.[ch]
Sam Leonard [Thu, 12 Oct 2023 11:56:08 +0000 (12:56 +0100)] 
nspawn: moved nspawn-creds.[ch] to shared/machine-credential.[ch]

This was done in order to allow sharing of this code between
systemd-nspawn and systemd-vmspawn.

2 years agomount-util: call CLEANUP_ARRAY after allocating array
Luca Boccassi [Thu, 2 Nov 2023 09:34:18 +0000 (09:34 +0000)] 
mount-util: call CLEANUP_ARRAY after allocating array

Coverity gets confused if it is called before.

CID#1523757

2 years agoupdate TODO 29748/head
Lennart Poettering [Mon, 30 Oct 2023 11:28:57 +0000 (12:28 +0100)] 
update TODO

2 years agoupdate NEWS
Lennart Poettering [Thu, 2 Nov 2023 10:35:39 +0000 (11:35 +0100)] 
update NEWS

2 years agotest: add integration test for systemd-storagetm
Lennart Poettering [Wed, 1 Nov 2023 18:17:02 +0000 (19:17 +0100)] 
test: add integration test for systemd-storagetm

2 years agoman: add docs for new storagetm service
Lennart Poettering [Mon, 30 Oct 2023 11:12:59 +0000 (12:12 +0100)] 
man: add docs for new storagetm service

2 years agostoragetm: add new systemd-storagetm component
Lennart Poettering [Fri, 27 Oct 2023 12:25:49 +0000 (14:25 +0200)] 
storagetm: add new systemd-storagetm component

This implements a "storage target mode", similar to what MacOS provides
since a long time as "Target Disk Mode":

        https://en.wikipedia.org/wiki/Target_Disk_Mode

This implementation is relatively simple:

1. a new generic target "storage-target-mode.target" is added, which
   when booted into defines the target mode.

2. a small tool and service "systemd-storagetm.service" is added which
   exposes a specific device or all devices as NVMe-TCP devices over the
   network.  NVMe-TCP appears to be hot shit right now how to expose
   block devices over the network. And it's really simple to set up via
   configs, hence our code is relatively short and neat.

The idea is that systemd-storagetm.target can be extended sooner or
later, for example to expose block devices also as USB mass storage
devices and similar, in case the system has "dual mode" USB controller
that can also work as device, not just as host. (And people could also
plug in sharing as NBD, iSCSI, whatever they want.)

How to use this? Boot into your system with a kernel cmdline of
"rd.systemd.unit=storage-target-mode.target ip=link-local", and you'll see on
screen the precise "nvme connect" command line to make the relevant
block devices available locally on some other machine. This all requires
that the target mode stuff is included in the initrd of course. And the
system will the stay in the initrd forever.

Why bother? Primarily three use-cases:

1. Debug a broken system: with very few dependencies during boot get
   access to the raw block device of a broken machine.

2. Migrate from system to another system, by dd'ing the old to the new
   directly.

3. Installing an OS remotely on some device (for example via Thunderbolt
   networking)

(And there might be more, for example the ability to boot from a
laptop's disk on another system)

Limitations:

1. There's no authentication/encryption. Hence: use this on local links
   only.

2. NVMe target mode on Linux supports r/w operation only. Ideally, we'd
   have a read-only mode, for security reasons, and default to it.

Future love:

1. We should have another mode, where we simply expose the homed LUKS
   home dirs like that.

2. Some lightweight hookup with plymouth, to display a (shortened)
   version of the info we write to the console.

To test all this, just run:

    mkosi --kernel-command-line-extra="rd.systemd.unit=storage-target-mode.target" qemu

2 years agoglyph-util: add computer disk + world emoji
Lennart Poettering [Mon, 30 Oct 2023 08:48:44 +0000 (09:48 +0100)] 
glyph-util: add computer disk + world emoji

2 years agosd-netlink: add call to query sd_event object an sd_netlink object is attached to
Lennart Poettering [Fri, 27 Oct 2023 21:16:06 +0000 (23:16 +0200)] 
sd-netlink: add call to query sd_event object an sd_netlink object is attached to

This mimics a similar call sd_bus_get_event() that already exists for
sd-bus.

2 years agoblockdev-util: export block_device_get_originating()
Lennart Poettering [Fri, 27 Oct 2023 16:16:19 +0000 (18:16 +0200)] 
blockdev-util: export block_device_get_originating()

2 years agoudevadm-lock: switch things over to lock_generic_with_timeout()
Lennart Poettering [Thu, 2 Nov 2023 10:08:29 +0000 (11:08 +0100)] 
udevadm-lock: switch things over to lock_generic_with_timeout()

This replaces the local implementation of a timeout file lock with our
new generic one.

Note that a comment in the old code claimed we couldn't use alarm()-like timeouts,
but htat's not entirely true: we can if we use SIGKILL, and thus know
for sure that the process will be dead in case the timer is hit before
we actually enter the file lock syscall. But we also know it will be
delivered if we hit after.

2 years agolock-util: add a new lock_generic_with_timeout() helper
Lennart Poettering [Thu, 2 Nov 2023 10:07:14 +0000 (11:07 +0100)] 
lock-util: add a new lock_generic_with_timeout() helper

This is just like lock_generic(), but applies the lock with a timeout.
This requires jumping through some hoops by executing things in a child
process, so that we can abort if necessary via a timer. Linux after all
has no native way to take file locks with a timeout.

2 years agoprocess-util: add new FORK_DEATHSIG_SIGKILL flag, rename FORK_DEATHSIG → FORK_DEATHSI...
Lennart Poettering [Thu, 2 Nov 2023 10:04:36 +0000 (11:04 +0100)] 
process-util: add new FORK_DEATHSIG_SIGKILL flag, rename FORK_DEATHSIG → FORK_DEATHSIG_SIGTERM

Sometimes it makes sense to hard kill a client if we die. Let's hence
add a third FORK_DEATHSIG flag for this purpose: FORK_DEATHSIG_SIGKILL.

To make things less confusing this also renames FORK_DEATHSIG to
FORK_DEATHSIG_SIGTERM to make clear it sends SIGTERM. We already had
FORK_DEATHSIG_SIGINT, hence this makes things nicely symmetric.

A bunch of users are switched over for FORK_DEATHSIG_SIGKILL where we
know it's safe to abort things abruptly. This should make some kernel
cases more robust, since we cannot get confused by signal masks or such.

While we are at it, also fix a bunch of bugs where we didn't take
FORK_DEATHSIG_SIGINT into account in safe_fork()

2 years agofd-util: add new FORMAT_PROC_PID_FD_PATH() helper
Lennart Poettering [Thu, 2 Nov 2023 10:31:13 +0000 (11:31 +0100)] 
fd-util: add new FORMAT_PROC_PID_FD_PATH() helper

This is just like FORMAT_PROC_FD_PATH() but goes via the PID number
rather than the "self" symlink.

This is useful whenever we want to generate a path that is useful
outside of our local scope.

2 years agomkosi: explicitly disable KVM in GHA runs
Luca Boccassi [Thu, 2 Nov 2023 11:01:23 +0000 (11:01 +0000)] 
mkosi: explicitly disable KVM in GHA runs

mkosi detects whether /dev/kvm is available and uses it if it is. But
some GHA hosts have it, but it's broken and not supported, so we need
to explicitly disable it.

2 years agoNEWS: several updates for networking
Yu Watanabe [Thu, 2 Nov 2023 06:36:29 +0000 (15:36 +0900)] 
NEWS: several updates for networking

2 years agovarlink,json: introduce new varlink_dispatch() helper
Lennart Poettering [Wed, 1 Nov 2023 17:36:12 +0000 (18:36 +0100)] 
varlink,json: introduce new varlink_dispatch() helper

varlink_dispatch() is a simple wrapper around json_dispatch() that
returns clean, standards-compliant InvalidParameter error back to
clients, if the specified JSON cannot be parsed properly.

For this json_dispatch() is extended to return the offending field's
name. Because it already has quite a few parameters, I then renamed
json_dispatch() to json_dispatch_full() and made json_dispatch() a
wrapper around it that passes the new argument as NULL. While doing so I
figured we should also get rid of the bad= argument in the short
wrapper, since it's only used in the OCI code.

To simplify the OCI code this adds a second wrapper oci_dispatch()
around json_dispatch_full(), that fills in bad= the way we want.

Net result: instead of one json_dispatch() call there are now:

1. json_dispatch_full() for the fully feature mother of all dispathers.
2. json_dispatch() for the simpler version that you want to use most of
   the time.
3. varlink_dispatch() that generates nice Varlink errors
4. oci_dispatch() that does the OCI specific error handling

And that's all there is.