Commit Graph
59271 Commits
Author SHA1 Message Date
Yu Watanabe 1af39ef2f6 test: wait for whole block device instead of partition
In 'udevadm lock' the device /dev/loopX is locked instead of
/dev/loopXp1. Hence, 'udevadm wait' should wait for /dev/loopX.

For some reasons, the kernel sometimes does not emit uevent for
partitions, and 'udevadm wait' for partitions may fail.

Fixes #24360.
2022-08-20 09:01:14 +09:00
Frantisek Sumsal bea9d62bdb test: correctly process multiline strings in $KERNEL_APPEND
Some tests (like TEST-02) set a multiline string to $KERNEL_APPEND
(which is a valid thing to do), unfortunately we'd use only the first
line of it and throw the rest away, e.g:

```
$ printf "%s" "$x"
hello

this is a multiline

kernel command line
$ read -ra out <<< "$x"
$ printf "%s" "${out[@]}"
hello
```

Let's use readarray/mapfile instead to avoid this:

```
$ readarray out <<< "$x"
$ printf "%s" "${out[@]}"
hello

this is a multiline

kernel command line

```
2022-08-19 22:31:32 +01:00
Lennart Poettering c06b6d46fd measure: add json output 2022-08-19 23:26:09 +02:00
Lennart Poettering 82b0039eb0 Merge pull request #24368 from poettering/tpm2-json-pcr-array-rework
tpm2: add helpers for building/parsing JSON arrays of PCR indexes
2022-08-19 21:51:47 +02:00
Luca Boccassi 3093b158bc Merge pull request #24350 from DaanDeMeyer/docs-pkexec
docs: Recommend pkexec over using an askpass program with sudo
2022-08-19 20:43:50 +01:00
Lennart Poettering 222a951fa4 tpm2-util: introduce tpm2_parse_pcr_argument() helper
Add a new tpm2_parse_pcr_argument() helper that unifies how we merge PCR
masks in a single function, we can use all over the place. Previously we
had basically the same code for this at 4 places.
2022-08-19 21:26:26 +02:00
Michal Sekletar 466266c172 rules: import previous SYSTEMD_READY state for suspended DM devices and skip other rules
We can't get any FS meta-data from a suspended device. Hence defer
making any plugged/unplugged decisions, i.e. we just import whatever was
previous state and skip processing all other rules.

Thanks Lennart Poettering <lennart@poettering.net> for suggesting this
solution.
2022-08-19 20:13:47 +01:00
Lennart Poettering 98193c39c6 tpm2-util: expose more hash algorithms
swtpm supports them, hence maybe support them in our codebase, too
2022-08-19 20:12:49 +01:00
Lennart Poettering df6c3cbd02 tpm2-util: add TPM2_PCR_MASK_VALID() helper 2022-08-19 20:12:20 +01:00
Lennart Poettering d8776eed9b TEST-70-TPM2: use "truncate" to generate disk image
Let'se operate on a sparse file here, to reuduce memory use.
2022-08-19 16:34:30 +02:00
Lennart Poettering 1dad9cd766 Merge pull request #24362 from poettering/sha256-tweaks
some tweaks to the sha256 implementation
2022-08-19 16:33:35 +02:00
Lennart Poettering 8de8ec88da tpm2-util: also add helper for parsing PCR arrays 2022-08-19 16:30:37 +02:00
Lennart Poettering 4436081e9d tpm2-util: split out helpers which format a PCR mask as a JSON array
This makes the code easier to read, and is something we can reuse later
on.
2022-08-19 16:29:38 +02:00
Lennart Poettering 2ab1fb77e2 tree-wide: pass proper values (not bools) to sd_event_source_set_enabled() 2022-08-19 14:56:26 +02:00
Lennart Poettering 7484c60ec6 Merge pull request #23653 from aafeijoo-suse/ask-for-recovery-key
cryptsetup: improve password prompt text
2022-08-19 14:55:54 +02:00
Rene Hollander d9bdb29bf5 Add --efi-boot-option-description argument to bootctl to control the name of the boot
entry.

By default an entry named "Linux Boot Manager" is created (which is the
previous behavior). With the flag the name of the entry can be
controlled, which is useful when installing systemd-boot to multiple ESP
partitions and having uniquely named entries.

Fixes #17044.
2022-08-19 14:55:31 +02:00
Lennart Poettering be06a84c8d TEST-70-TPM2: actually enable systemd-measure test
A bit emberassing that this never worked.
2022-08-19 14:54:30 +02:00
Lennart Poettering a0789e5fb8 cryptsetup: make sure all token-based codepaths are effected by SYSTEMD_CRYPTSETUP_USE_TOKEN_MODULE env var
Previously the env var was only checked when conditionalizing use of our
own libcryptsetup loadable token modules.  But let's also use it for any
other kind of token module, including possible internal ones by
libcryptsetup.
2022-08-19 14:53:54 +02:00
Lennart Poettering d1b2e04328 cryptsetup: use right internal helper when checking whether to use tokens
The other codepaths get this right, the TPM2 one currently does not. Fix
that.
2022-08-19 14:53:11 +02:00
Lennart Poettering 558d96240b sha256: add sha256_direct()/SHA256_DIRECT() helpers 2022-08-19 12:53:04 +02:00
Lennart Poettering 00b4663813 random-seed: use SHA256_DIGEST_SIZE 2022-08-19 12:53:04 +02:00
Lennart Poettering 3c4d5f2ff5 sha256: change digest buffer type to uint8_t[]
This way we can specify a size with "static". All users use uint8_t
already, hence this comes at no price.
2022-08-19 12:53:04 +02:00
Franck Bui 570fe6f12b Drop the limit on number of inodes for /dev
Follow-up for 4c733d3046.

Finding a suitable limit that would fit any use cases out there is pretty hard
and since /dev is only writeable by root anyway, let's simply drop the limit.
2022-08-19 11:25:21 +02:00
Antonio Alvarez Feijoo 2b56004001 update TODO 2022-08-19 09:02:17 +02:00
Antonio Alvarez Feijoo b6c0bd11fc cryptsetup: improve password prompt text
Instead of always asking for passphrase, if the device has LUKS2 header check:
- If only regular passphrases are registered, ask for passphrase.
- If only recovery keys are registered, ask for recovery key.
- If both regular passphrases and recovery keys are registered, ask for
passphrase or recovery key.
2022-08-19 09:01:56 +02:00
Yu Watanabe 0b755a9809 Merge pull request #24353 from alpernebbi/hwdb-cros-ec-accel-base
udev: hwdb: Add orientation quirk for base-mounted accelerometers on Chromebooks

Reviewed-by: Alexandru Stan <amstan@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2022-08-19 14:39:47 +09:00
Yu Watanabe ade100f3b6 Merge pull request #24348 from yuwata/network-ipv4acd-renew
network: fix IPv4ACD issues on DHCP renewal or reconfiguring interface
2022-08-19 14:27:05 +09:00
Alper Nebi Yasak ac3c031e38 udev: hwdb: Add rules to match cros-ec-accel by 'location' sysfs file
The cros-ec-accel devices report their mounting location by the 'label'
sysfs file only since Linux v6.0. With earlier kernels, a nonstandard
'location' file reports this, but slightly differently (lid instead of
display) [1].

Add udev rules to import the correct hwdb entries based on this
'location' file for cros-ec-accel devices, so that the base-mounted
accel matrix has the correct value for older kernels as well.

[1] https://kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio-cros-ec
2022-08-18 21:17:19 +03:00
Alper Nebi Yasak fea267f8c7 hwdb: Add Chromebook accel orientation quirks based on sysfs label
The base-mounted accelerometer on Chromebooks return values same as the
display when the lid angle is 180 degrees, instead of when the lid is
closed. To match userspace expectations we must further rotate the
existing accelerometer mounting matrix by 180 degrees around the X axis:

    [[-1,  0,  0],    [[ 1,  0,  0],    [[-1,  0,  0],
     [ 0, -1,  0],  X  [ 0, -1,  0],  =  [ 0,  1,  0],
     [ 0,  0, -1]]     [ 0,  0, -1]]     [ 0,  0,  1]]

A previous commit lets us distinguish between the two cros-ec-accel
devices on these boards by their 'label' sysfs file. Add hwdb entries
that make base-mounted accelerometers use this correct matrix, and
display-mounted ones use the existing one.

Note that the cros-ec-accel drivers use 'label' only since Linux v6.0.
The old match strings are not removed to support older kernels, even
though they are only correct for the display-mounted sensor.
2022-08-18 21:17:19 +03:00
Alper Nebi Yasak e2f25ae648 udev: hwdb: Match iio sensors based on their label
The IIO subsystem exposes a 'label' sysfs file to help userspace better
identify its devices [1]. Standardized labels include the sensor type
along with its location, including 'accel-base' and 'accel-display'.

Most Chrome OS boards have two accelerometers that are indistinguishable
except for this label (or a 'location' sysfs file before Linux v6.0),
and need different mounting matrix corrections based on their location.

Add a udev rule that matches hwdb entries using this label, so we can
correct both accelerometers on these devices with hwdb entries. The
existing rules and hwdb entries are not modified to keep potential
out-of-tree entries working, but new entries in this form will override
existing ones. Also add currently standardized labels to parse-hwdb.py.

[1] https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio
2022-08-18 21:17:19 +03:00
Frantisek Sumsal cd7ad0cbde Merge pull request #24054 from keszybz/initrd-no-reload
Don't do daemon-reload in the initrd
2022-08-18 13:15:14 +00:00
Daan De Meyer 2d92c35b35 docs: Add guide to debug binaries in vscode that need to run as root 2022-08-18 14:46:01 +02:00
Daan De Meyer d1e9a4244b docs: Recommend pkexec over using an askpass program with sudo
Less configuration required than downloading and configuring an
askpass program.
2022-08-18 14:17:07 +02:00
Luca Boccassi 0a152619ac bash-completion: autocomplete cgroup names in systemd-cgtop 2022-08-18 12:58:12 +01:00
Zbigniew Jędrzejewski-Szmek db5276215a initrd-parse-etc: override argv[0] to avoid dracut issue
Quoting https://github.com/systemd/systemd/pull/24054#issuecomment-1210501631:
> this would need a patch in dracut, specifically adding the
> systemd-sysroot-fstab-check to the list of installed stuff:
> https://github.com/dracutdevs/dracut/blob/fe8fa2b0cadbb33e27c8dd8b5851548dcd65835c/modules.d/00systemd/module-setup.sh#L47.
>
> I could do this manually in the CI (and I guess I'd have to do it anyway even
> if the patch lands in upstream, since it won't be available in C8S), but it
> should get there first before merging this PR, otherwise it's going to break
> Rawhide.
2022-08-18 10:27:44 +02:00
Yu Watanabe 3af934bceb test-network: add tests for IPv4ACD and renewing DHCP address 2022-08-18 15:44:53 +09:00
Yu Watanabe fd022b1da5 test-network: drop unused .network file 2022-08-18 15:44:53 +09:00
Yu Watanabe 03ff3c5a46 network: unref existing sd_ipv4acd object when not necessary
On reconfiguring an interface, the new setting may not enable IPv4ACD
for an existing address anymore. Hence, we need to unref it. Otherwise,
newly requested addresses may never be ready for (re-)configuring.
2022-08-18 15:44:39 +09:00
Yu Watanabe 3c45d0d099 network: update setting for IPv4ACD or IPv6DAD in existing Address objects
Otherwise, if the setting is changed on reconfigure, the new setting
is not applied to the existing addresses.
2022-08-18 15:44:30 +09:00
Yu Watanabe e402e99eaa network: fix DHCPv4 address renewal with IPv4ACD
Previously, when a DHCP address is renewed and if the IPv4ACD for the
address is enabled, the address will never drop the probing flag, thus
the lifetime of the address will never be updated.

This drops NETWORK_CONFIG_STATE_PROBING, and the IPv4ACD status is
managed another bit, Address.acd_bound. And, the flag is updated only
when the IPv4ACD announced the address or detects conflict.
2022-08-18 15:44:23 +09:00
Luca Boccassi 5ad8116a87 test: expect libdevmapper failure in TEST-50-DISSECT
libdevmapper/device mapper driver can return semi-random failures when
opening verity devices, and we have fallback code to deal with it.
But the test was not expecting the fallback path, so it became unreliable.

Fixes https://github.com/systemd/systemd/issues/23866
2022-08-18 01:35:06 +01:00
Zbigniew Jędrzejewski-Szmek 87305b0fbf sd-messages: rename newly added constants
This hasn't been through a release yet, so we are free to change the name.

Closes #24270.
C.f. https://github.com/systemd/systemd/commit/907506695549c689710cd267583f6fd439711dcf#r80812414
2022-08-17 22:01:54 +09:00
Zbigniew Jędrzejewski-Szmek ed7f7a984d sd-messages: make the table wider
For whatever reason, nowadays we add entries that are quite long, so
we were using line continuation for most of new entries. This is hard
to read and edit. So let's just make the table wide enough to accomodate
all the names without line splits.
2022-08-17 22:01:54 +09:00
Lennart Poettering 4dde902ea0 tpm2-util: more structure initialization simplifications 2022-08-17 21:59:47 +09:00
Lennart Poettering 582fc142da random-util: drop unnecessary header file
(And some minor reindents)
2022-08-17 21:59:28 +09:00
Yu Watanabe 190169e591 Merge pull request #24250 from yuwata/backlight-multiple-graphics-cards
backlight: support multiple graphics cards system
2022-08-17 21:58:59 +09:00
Lennart Poettering 86b4e141a5 fs-util: make touch() an inline function 2022-08-17 21:58:33 +09:00
Lennart Poettering aba5dac372 tpm2-util: credit TPM2 RNG entropy only once per boot
Acquiring random data from the TPM is not precisely quick, let's speed
things up by doing this at most once per boot. For that, let's maintain
a flag file in /run/.
2022-08-17 21:58:17 +09:00
Yu Watanabe f9b3b99017 udev: rename various validate() -> should_reload() for builtin commands
Previously, true by validate() means several configs are outdated and we
need to reload configs. That's not intuitive for me. Let's rename the
functions.
2022-08-17 21:56:46 +09:00
Yu Watanabe 0161378cf7 Merge pull request #24333 from yuwata/sysctl
sysctl: improve performance for applying glob pattern
2022-08-17 21:56:15 +09:00