From 963ea30a5d69b9e2094c33f430157804e32a5a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 24 Nov 2023 15:19:50 +0100 Subject: [PATCH 1/3] man: reword the list of PE sections in systemd-stub Let's put the section name at the beginning of each sentence. This way we can avoid awkward constructs like "kernel is looked for in the .linux section". Also, since the paragraph above says that this is a list of "PE sections", we can just say "section". In other places, it is often useful to say "PE section" to avoid ambiguity. Also fix the off-by-one in the count of sections. --- man/systemd-stub.xml | 70 +++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/man/systemd-stub.xml b/man/systemd-stub.xml index 184b10bc883fa..6e853336c224f 100644 --- a/man/systemd-stub.xml +++ b/man/systemd-stub.xml @@ -55,38 +55,37 @@ - The ELF Linux kernel images will be looked for in the .linux PE - section of the executed image. + A .linux section with the ELF Linux kernel image. - OS release information, i.e. the - os-release5 file of - the OS the kernel belongs to, in the .osrel PE section. + An .osrel section with OS release information, i.e. the contents of + the os-release5 file + of the OS the kernel belongs to. - The kernel command line to pass to the invoked kernel will be looked for in the - .cmdline PE section. + A .cmdline section with the kernel command line to pass to the + invoked kernel. - The initrd will be loaded from the .initrd PE - section. + An .initrd section with the initrd. - A boot splash (in Windows .BMP format) to show on screen before - invoking the kernel will be looked for in the .splash PE section. + A .splash section with an image (in the Windows + .BMP format) to show on screen before invoking the kernel. - A compiled binary DeviceTree will be looked for in the .dtb PE - section. + A .dtb section with a compiled binary DeviceTree. - Kernel version information, i.e. the output of uname -r for the - kernel included in the UKI, in the .uname PE section. + A .uname section with the kernel version information, i.e. the + output of uname -r for the kernel included in the .linux + section. - SBAT revocation - metadata, in the .sbat PE section. + An .sbat section with + SBAT revocation + metadata. - A set of cryptographic signatures for expected TPM2 PCR values when this kernel is - booted, in JSON format, in the .pcrsig section. This is useful for implementing TPM2 - policies that bind disk encryption and similar to kernels that are signed by a specific - key. + A .pcrsig section with a set of cryptographic signatures for the + expected TPM2 PCR values after the kernel has been booted, in JSON format. This is useful for + implementing TPM2 policies that bind disk encryption and similar to kernels that are signed by a + specific key. - A public key in PEM format matching this TPM2 PCR signature data in the - .pcrpkey section. + A .pcrpkey section with a public key in the PEM format matching the + signature data in the the .pcrsig section. If UEFI SecureBoot is enabled and the .cmdline section is present in the executed @@ -100,15 +99,14 @@ DeviceTree in the corresponding EFI configuration table. systemd-stub will ask the firmware via the EFI_DT_FIXUP_PROTOCOL for hardware specific fixups to the DeviceTree. - The contents of seven of these eight PE sections are measured into TPM PCR 11, that is otherwise - not used. Thus, it can be pre-calculated without too much effort. The .pcrsig section - is not included in this PCR measurement, since it's supposed to contain signatures for the expected - results for these measurements, i.e. of the outputs of the measurement operation, and thus cannot also be - input to it. + The contents of eight of these nine sections are measured into TPM PCR 11. It is otherwise not used + and thus the result can be pre-calculated without too much effort. The .pcrsig section + is not included in this PCR measurement, since it is supposed to contain signatures for the output of the + measurement operation, and thus cannot also be input to it. - When .pcrsig and/or .pcrpkey are present in a unified kernel - image their contents are passed to the booted kernel in an synthetic initrd cpio archive that places them in the - /.extra/tpm2-pcr-signature.json and + When .pcrsig and/or .pcrpkey sections are present in a + unified kernel image their contents are passed to the booted kernel in an synthetic initrd cpio archive + that places them in the /.extra/tpm2-pcr-signature.json and /.extra/tpm2-pcr-public-key.pem files. Typically, a tmpfiles.d5 line then ensures they are copied into /run/systemd/tpm2-pcr-signature.json and @@ -395,7 +393,8 @@ / - The main initrd from the .initrd PE section of the unified kernel image. + The main initrd from the .initrd PE section of the unified kernel + image. @@ -412,8 +411,8 @@ /.extra/global_credentials/*.cred - Similar, credential files in the /loader/credentials/ directory - in the file system the unified kernel image is placed in are copied into the + Similarly, credential files in the /loader/credentials/ + directory in the file system the unified kernel image is placed in are copied into the /.extra/global_credentials/ directory in the initrd execution environment. @@ -433,8 +432,7 @@ /.extra/tpm2-pcr-signature.json The TPM2 PCR signature JSON object included in the .pcrsig PE section of the unified kernel image is copied into the - /.extra/tpm2-pcr-signature.json file in the initrd execution - environment. + /.extra/tpm2-pcr-signature.json file in the initrd execution environment. From 467cd9f0a55a502f2866ccb1a7a22d188c3bafb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 25 Nov 2023 13:15:31 +0100 Subject: [PATCH 2/3] man/systemd-vconsole-setup: improve markup --- man/systemd-vconsole-setup.service.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/systemd-vconsole-setup.service.xml b/man/systemd-vconsole-setup.service.xml index 614a4d48d268d..90931126db84c 100644 --- a/man/systemd-vconsole-setup.service.xml +++ b/man/systemd-vconsole-setup.service.xml @@ -33,7 +33,7 @@ Description - systemd-vconsole-setup sets up and configures either all virtual consoles, or + systemd-vconsole-setup sets up and configures either all virtual consoles, or — if the optional TTY parameter is provided — a specific one. When the system is booting up, systemd-vconsole-setup.service is called by systemd-udevd8 during From 4704176795c167d49f87dfea79193913e6c6d939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 25 Nov 2023 13:27:17 +0100 Subject: [PATCH 3/3] units: disable start rate limit for systemd-vconsole-setup.service The unit will be started or restarted a few times during boot, but but it has StartLimitBurst = DefaultStartLimitBurst = 5, which means that the fifth restart will already fail. On my laptop, I have exactly 4 restarts, so I don't hit the limit, but on a slightly different system we will easily hit the limit. In https://bugzilla.redhat.com/show_bug.cgi?id=2251394, there are five reloads and we hit the limit. Since 6ef512c0bb7aeb2000588d7d05e23b4681da8657 we propagate the start counter over switch-root and daemon reloads, so it's easier to hit the limit during boot. In principle there might be systems with lots of vtcon devices, so let's just allow the unit to be restarted without a limit. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2251394. --- units/systemd-vconsole-setup.service.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/units/systemd-vconsole-setup.service.in b/units/systemd-vconsole-setup.service.in index 3475d456bc918..c6c5bc9130a3f 100644 --- a/units/systemd-vconsole-setup.service.in +++ b/units/systemd-vconsole-setup.service.in @@ -17,6 +17,12 @@ DefaultDependencies=no Before=sysinit.target Before=initrd-switch-root.target shutdown.target +# This unit will be restarted by udev whenever a new vtcon device appears or is +# triggered. Usually that happens just a handful of times during boot, but some +# systems may have hundreds or thousands of serial consoles connected, so let's +# just disable the limit altogether. +StartLimitIntervalSec=0 + [Service] Type=oneshot # This service will be restarted by udev whenever a new vtcon device appears.