]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stub: measure PE sections in a defined order, and include all sections
authorLennart Poettering <lennart@poettering.net>
Mon, 25 Jul 2022 22:13:06 +0000 (00:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 Aug 2022 08:28:49 +0000 (10:28 +0200)
src/boot/efi/stub.c

index 9ec01d1baa6361eae94fb15e009670ec53f33cce..1afbde3295291103532d5671ad80a7da7c0c0aa3 100644 (file)
@@ -150,8 +150,10 @@ static void export_variables(EFI_LOADED_IMAGE_PROTOCOL *loaded_image) {
 EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
 
         enum Section {
-                SECTION_CMDLINE,
+                /* This is the canonical order in which we measure the sections. PLEASE DO NOT REORDER! */
                 SECTION_LINUX,
+                SECTION_OSREL,
+                SECTION_CMDLINE,
                 SECTION_INITRD,
                 SECTION_SPLASH,
                 SECTION_DTB,
@@ -159,8 +161,9 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
         };
 
         static const char * const sections[_SECTION_MAX + 1] = {
-                [SECTION_CMDLINE] = ".cmdline",
                 [SECTION_LINUX]   = ".linux",
+                [SECTION_OSREL]   = ".osrel",
+                [SECTION_CMDLINE] = ".cmdline",
                 [SECTION_INITRD]  = ".initrd",
                 [SECTION_SPLASH]  = ".splash",
                 [SECTION_DTB]     = ".dtb",