]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stub: get uname from image before loading addons
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Fri, 19 Apr 2024 09:29:31 +0000 (11:29 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 19 Apr 2024 18:37:39 +0000 (20:37 +0200)
Otherwise uname is always NULL before calling `load_addons()`, so it's not being
checked if .uname matches between addons and UKI.

Fixes 68f85761e2eb1fd2243019980a64b174f07432c3

src/boot/efi/stub.c

index 58586f942faa4ccb6bee87450be72e260944af76..3511e2c9998471cbfd314a34eaee40bf1387d86d 100644 (file)
@@ -541,6 +541,10 @@ static EFI_STATUS run(EFI_HANDLE image) {
         CLEANUP_ARRAY(dt_filenames_addons_global, n_dts_addons_global, dt_filenames_free);
         CLEANUP_ARRAY(dt_filenames_addons_uki, n_dts_addons_uki, dt_filenames_free);
 
+        if (szs[UNIFIED_SECTION_UNAME] > 0)
+                uname = xstrndup8((char *)loaded_image->ImageBase + addrs[UNIFIED_SECTION_UNAME],
+                                  szs[UNIFIED_SECTION_UNAME]);
+
         /* Now that we have the UKI sections loaded, also load global first and then local (per-UKI)
          * addons. The data is loaded at once, and then used later. */
         err = load_addons(
@@ -615,10 +619,6 @@ static EFI_STATUS run(EFI_HANDLE image) {
         /* Show splash screen as early as possible */
         graphics_splash((const uint8_t*) loaded_image->ImageBase + addrs[UNIFIED_SECTION_SPLASH], szs[UNIFIED_SECTION_SPLASH]);
 
-        if (szs[UNIFIED_SECTION_UNAME] > 0)
-                uname = xstrndup8((char *)loaded_image->ImageBase + addrs[UNIFIED_SECTION_UNAME],
-                                  szs[UNIFIED_SECTION_UNAME]);
-
         if (use_load_options(image, loaded_image, szs[UNIFIED_SECTION_CMDLINE] > 0, &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