]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stub: Remove overlapping PE section warning
authorJan Janssen <medhefgo@web.de>
Tue, 14 Mar 2023 13:32:43 +0000 (14:32 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 15 Mar 2023 00:24:17 +0000 (00:24 +0000)
Now that we always create PE images with a non-zero image base we cannot
run into this issue anymore. Any tool that still uses the old hard-coded
section offsets will end up creating bad images with sections below the
image base. objcopy will warn about this and any PE loader will simply
refuse to load such an image. Meanwhile updated tools do not use
hard-coded offsets anymore.

src/boot/efi/pe.c

index 9b1b10d4a12cf74af9cb17b010a653242c0d6aac..e516417c07158199689f44acb1ecf361626b77c2 100644 (file)
@@ -153,17 +153,9 @@ static void locate_sections(
         assert(offsets);
         assert(sizes);
 
-        size_t prev_section_addr = 0;
-
         for (size_t i = 0; i < n_table; i++) {
                 const PeSectionHeader *sect = section_table + i;
 
-                if (in_memory) {
-                        if (prev_section_addr > sect->VirtualAddress)
-                                log_error("Overlapping PE sections detected. Boot may fail due to image memory corruption!");
-                        prev_section_addr = sect->VirtualAddress + sect->VirtualSize;
-                }
-
                 for (size_t j = 0; sections[j]; j++) {
                         if (memcmp(sect->Name, sections[j], strlen8(sections[j])) != 0)
                                 continue;