1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-15 18:50:12 +03:00

41769 Commits

Author SHA1 Message Date
Luca Boccassi
0bdf70f3fa
Merge pull request from lnussel/bootctl
bootctl: unlink and cleanup functions
2023-01-19 20:21:52 +00:00
Mike Yuan
017a7ba4f4
core: propagate stop too if restart is issued
The restart of a unit should also be considered as that
a stop job happens, and thus gets propagated to units
specified using PropagatesStopTo=.

Fixes 
2023-01-19 21:56:58 +08:00
Ludwig Nussel
8702496bfb bootctl: unlink and cleanup functions
The unlink command removes an entry from the ESP including
referenced files that are not referenced in other entries. That is
useful eg to have multiple entries that use the same kernel with
different options.

The cleanup command removes all files that are not referenced by any
entry.
2023-01-19 14:24:43 +01:00
Sam James
e3342b2d3f bpf: disable -fstack-protector in meson
In Gentoo, we recently started making Clang behave the same way as
our GCC, with -fstack-protector and some friends enabled by default.

SSP doesn't make sense for BPF, so disable it explicitly.

See also e.g. https://www.spinics.net/lists/netdev/msg556400.html.

Bug: https://bugs.gentoo.org/890004
2023-01-19 13:12:15 +00:00
Ludwig Nussel
1132fd73b3 chase-symlinks: new chase_symlinks_and_unlink() 2023-01-19 14:11:12 +01:00
Yu Watanabe
3402357063 in-addr-util: drop unused mode to parse prefix length 2023-01-19 22:09:24 +09:00
Yu Watanabe
e5e0743189 network: assume prefix length is full address size
The commit 0f707207b9fc04d45ad176930cfefc77c0068545 enables strong
warning about missing prefix length in Address= setting.
The change was done in v241, and was about 4 years ago.
Let's drop the legacy assumption and make the parser consistent with
'ip address' command.

C.f. .
Closes .
2023-01-19 22:09:10 +09:00
Yu Watanabe
5908d86425 network: do not enter failed state when received an invalid RA
Fixes the issue reported at https://github.com/systemd/systemd/issues/25891#issuecomment-1368509262.
2023-01-19 12:36:26 +00:00
Yu Watanabe
1193448cb6 udevadm-trigger: also check with the original syspath if device is renamed
For older kernels that synthetic UUID is not supported, we need to also
check the original device name, as udevd broadcasts uevent with new
sysname.

Fixes .
2023-01-19 17:58:05 +09:00
Yu Watanabe
dfbd824a0b udevadm-trigger: settle with synthetic UUID if the kernel support it
If the kernel support synthetic UUID in uevent, then let's assume that
the UUID is unique, and check only if the received UUID matches we
specified.

Partially fixes .
2023-01-19 17:57:56 +09:00
Yu Watanabe
b15039425f udevadm-trigger: allow to fallback without synthetic UUID only first time
If a device is successfully triggered with synthetic UUID, then that means
the kernel support it. Hence, it is not necessary to fallback without UUID
for later devices.
2023-01-19 17:55:21 +09:00
Yu Watanabe
3e61656fab sd-id128: introduce id128_hash_ops_free 2023-01-19 17:55:21 +09:00
Luca Boccassi
41d125614c
Merge pull request from medhefgo/efi-clang
boot: Add printf functions
2023-01-18 22:24:39 +00:00
William Roberts
aae6eb9611 tpm2: add salt to pin
Add a salt to the pin and store it in the TPM2 LUKS header for future
this. This adds entropy to user supplied pins and helps brute forcing
the passphrase on the key residing in the TPM or brute forcing bind key
encrypted sessions with low entropy passphrases.

Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2023-01-18 21:58:33 +00:00
Lennart Poettering
db5310cfc1
Merge pull request from joshua-zivkovic/JZ/plotjson-main
systemd-analyze: Add JSON and table output to systemd-analyze's plot
2023-01-18 18:11:12 +01:00
Lennart Poettering
a56182ddac
Merge pull request from kraxel/uki
bootctl: add is-uki command
2023-01-18 18:10:30 +01:00
Jan Janssen
9220b2c46b boot: Drop use of Print
The custom print helpers have been replaced with explicit checks at the
call site to keep this in line with the way it is done in userspace. Any
calls where the check has been ommited should not need them as the value
is expected to alawys be around.
2023-01-18 17:47:57 +01:00
Jan Janssen
2f3c3b0bee boot: Drop use of xpool_print/SPrint 2023-01-18 17:47:57 +01:00
Jan Janssen
5a9b915766 tree-wide: Use __func__ in asserts
clang puts the whole function signature in __PRETTY_FUNCTION__, which is
a bit excessive for something that can already be figured out by using
the line number.
2023-01-18 17:47:11 +01:00
Jan Janssen
5966c54df4 boot: Add log_trace debugging helper 2023-01-18 16:50:04 +01:00
Jan Janssen
6ac54809de boot: Introduce log_wait
Instead of stalling for every log message as it appears we now wait for
several messages at strategic locations.
2023-01-18 16:50:04 +01:00
Jan Janssen
c2c6203556 boot: Use printf for error logging
This also drops the _stall suffix in anticipation of the next commit.
2023-01-18 16:50:04 +01:00
Jan Janssen
7c4536a9af boot: Add printf functions 2023-01-18 16:50:04 +01:00
Joshua Zivkovic
ff46b2f97c systemd-analyze: Add table and JSON output implementation to plot 2023-01-18 14:33:08 +00:00
Lennart Poettering
11b6d7cba9
Merge pull request from fbuihuu/some-journald-improvements
Some journald improvements
2023-01-18 15:05:40 +01:00
Gerd Hoffmann
a05255981b bootctl: add kernel-inspect command
Takes a kernel image as argument. Prints details about the kernel.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2023-01-18 14:32:14 +01:00
Gerd Hoffmann
53c368d71b bootctl: add kernel-identity command
The command takes a kernel as argument and checks what kind of kernel
the image is.  Returns one of uki, pe or unknown.
2023-01-18 14:32:14 +01:00
Lennart Poettering
42c042cfd1
Merge pull request from poettering/dissect-sector-size
auto-detect intended sector size from DDI disk images, and configure loopback devices for it
2023-01-18 14:14:39 +01:00
Luca Boccassi
e0e7bc8223 core: add GetUnitByPIDFD method and use it in systemctl
A pid can be recycled, but a pidfd is pinned. Add a new method that is safer
as it takes a pidfd as input.
Return not only the D-Bus object path, but also the unit id and the last
recorded invocation id, as they are both useful (especially the id, as
converting from a path object to a unit id from a script requires another
round-trip via D-Bus).

Note that the manager still tracks processes by pid, so theorethically this
is not fully error-proof, but on the other hand the method response is
synchronous and the manager is single-threaded, so once a call is being
processed the unit database will not change anyway. Once the manager
switches to use pidfds everywhere, this can be further hardened.
2023-01-18 10:58:46 +01:00
Lennart Poettering
6c54e1d61f repart: auto-probe sector size when not specified 2023-01-18 10:47:17 +01:00
Lennart Poettering
81dde3d85d homework: when creating/resizing GPT partitions, also set sector size explicitly 2023-01-18 10:47:17 +01:00
Lennart Poettering
1d93c00386 dissect: show sector size in info output 2023-01-18 10:47:17 +01:00
Lennart Poettering
22ee78a898 loop-util: always tell kernel explicitly about loopback sector size
Let's not leave the sector size unspecified: either set a user supplied
value, or auto-detect the right size by probing the disk image
accordingly.
2023-01-18 10:47:17 +01:00
Lennart Poettering
05c4c59ff1 dissect-image: add probe_sector_size() helper for detecting sector size of a GPT disk image
When we operate with DDIs with sector sizes != 512 we need to configure
the loopback device to match it, otherwise the image and the kernel
block device will disagree what things are.

Let's add a prober that tries to determine the sector size of a GPT DDI.
It does this by looking for the GPT partition table header at the
various byte offsets they must be located on, given a specific sector
size. It will try sector size 512, 1024, 2048 and 4096. Of these only
the 512 and 4096 really make sense IRL I guess, but let's be thorough.
2023-01-18 10:10:57 +01:00
Lennart Poettering
1163ddb386 loop-util: insist on setting the sector size correctly
If we attach a disk image to a loopback device the sector size of the
image must match the one of the loopback device, hence be more careful
here.
2023-01-18 10:10:57 +01:00
Lennart Poettering
65046b92dc blockdev-util: add simple wrapper around BLKSSZGET
Just adds some typesafety and generates an error if the field is not
initialized in the block device yet.
2023-01-18 10:10:57 +01:00
Daan De Meyer
d3d308538e
Merge pull request from DaanDeMeyer/repart-sector-size
repart: Allow configuring sector size
2023-01-18 09:54:50 +01:00
Luca Boccassi
2cd1e475dd
Merge pull request from yuwata/udev-symlink-remove
udev: support -= operator for SYMLINK
2023-01-17 21:59:12 +00:00
8facac5fdd coredump: use fstatvfs to check the available space
Given that we already have the file descriptor opened for writing, it
would make sense to call fstatvfs with that file descriptor rather than
statvfs with the directory path that was used to open that descriptor.
2023-01-17 22:22:12 +01:00
Daan De Meyer
e1878ef72a repart: Allow configuring sector size
Let's allow users to configure the (logical) sector size of their
image. This is required when building images for a 4k sector size
disk on a 512b sector size host or vice-versa.
2023-01-17 20:09:22 +01:00
Daan De Meyer
065bdb6f0f mkfs-util: Shorten strv operations error handling 2023-01-17 19:50:48 +01:00
Jan Janssen
bb4e8820c1 boot: Fix missed argument to Print()
This fixes 3e87a057a796b57bf9540b948823fbefef6693d7, which passed the
path to the wrong Print() call. Miraculously, this was printing the
correct path during testing and was therefore missed.
2023-01-17 19:44:39 +01:00
chris
b895aa5ff5 send dhcpv6 release when stopping 2023-01-17 21:26:18 +09:00
Dan Streetman
1200777b21 tpm2: replace magic number 2023-01-17 11:04:37 +01:00
Lennart Poettering
a45215ed33
Merge pull request from poettering/pcr15
cryptsetup: measure LUKS volume keys to PCR 15
2023-01-17 11:04:03 +01:00
Lennart Poettering
5039eafb9f
Merge pull request from medhefgo/boot-hypervisor
boot: Detect hypervisors using SMBIOS info
2023-01-17 10:53:23 +01:00
Lennart Poettering
6c51b49ce0 tpm2: add common helper for checking if we are running on UKI with TPM measurements
Let's introduce a common implementation of a function that checks
whether we are booted on a kernel with systemd-stub that has TPM PCR
measurements enabled. Do our own userspace measurements only if we
detect that.

PCRs are scarce and most likely there are projects which already make
use of them in other ways. Hence, instead of blindly stepping into their
territory let's conditionalize things so that people have to explicitly
buy into our PCR assignments before we start measuring things into them.
Specifically bind everything to an UKI that reported measurements.

This was previously already implemented in systemd-pcrphase, but with
this change we expand this to all tools that process PCR measurement
settings.

The env var to override the check is renamed to SYSTEMD_FORCE_MEASURE,
to make it more generic (since we'll use it at multiple places now).
This is not a compat break, since the original env var for that was not
included in any stable release yet.
2023-01-17 09:42:16 +01:00
Lennart Poettering
04959faa63 generators: optionally, measure file systems at boot
If we use gpt-auto-generator, automatically measure root fs and /var.

Otherwise, add x-systemd.measure option to request this.
2023-01-17 09:42:16 +01:00
Lennart Poettering
50072ccf1b units: rework growfs units to be just a regular unit that is instantiated
The systemd-growfs@.service units are currently written in full for each
file system to grow. Which is kinda pointless given that (besides an
optional ordering dep) they contain always the same definition. Let's
fix that and add a static template for this logic, that the generator
simply instantiates (and adds an ordering dep for).

This mimics how systemd-fsck@.service is handled. Similar to the wait
that for root fs there's a special instance systemd-fsck-root.service
we also add a special instance systemd-growfs-root.service for the root
fs, since it has slightly different deps.

Fixes: 
See: 
2023-01-17 09:42:16 +01:00
Lennart Poettering
0ba07f9077 generator: teach generator_add_symlink() to instantiate specified unit
if we want generators to instantiate a template service, we need to
teach generator_add_symlink() the concept.

Just some preparation for a later commit.

While we are at it, modernize the function around
path_extract_filename() + path_extract_directory()
2023-01-17 09:42:16 +01:00