From 9f3bc7b505197c72dedc7fd169eacfbbd3d7bc2d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 26 Jun 2024 12:02:06 +0200 Subject: [PATCH] stub: slightly reorder things Let's do the section measurement first, before we use any data of it. Let's bring up the boot splash next, so that it covers anything else we might do. --- src/boot/efi/stub.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c index 5c07b66ea87..a0237bf112f 100644 --- a/src/boot/efi/stub.c +++ b/src/boot/efi/stub.c @@ -881,8 +881,6 @@ static EFI_STATUS run(EFI_HANDLE image) { if (err != EFI_SUCCESS) return log_error_status(err, "Error getting a LoadedImageProtocol handle: %m"); - refresh_random_seed(loaded_image); - err = pe_memory_locate_sections(loaded_image->ImageBase, unified_sections, sections); if (err != EFI_SUCCESS || !PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_LINUX)) { if (err == EFI_SUCCESS) @@ -890,6 +888,13 @@ static EFI_STATUS run(EFI_HANDLE image) { return log_error_status(err, "Unable to locate embedded .linux section: %m"); } + measure_sections(loaded_image, sections, §ions_measured); + + /* Show splash screen as early as possible, but after measuring it */ + display_splash(loaded_image, sections); + + refresh_random_seed(loaded_image); + lookup_uname(loaded_image, sections, &uname); /* Now that we have the UKI sections loaded, also load global first and then local (per-UKI) @@ -897,11 +902,6 @@ static EFI_STATUS run(EFI_HANDLE image) { CLEANUP_ARRAY(dt_addons, n_dt_addons, devicetree_addon_free_many); load_all_addons(image, loaded_image, uname, &cmdline_addons, &dt_addons, &n_dt_addons); - measure_sections(loaded_image, sections, §ions_measured); - - /* Show splash screen as early as possible */ - display_splash(loaded_image, sections); - if (use_load_options(image, loaded_image, /* have_cmdline= */ PE_SECTION_VECTOR_IS_SET(sections + UNIFIED_SECTION_CMDLINE), &cmdline)) { /* Let's measure the passed kernel command line into the TPM. Note that this possibly * duplicates what we already did in the boot menu, if that was already used. However, since