Message ID | 20190125114516.12127-4-agraf@suse.de |
---|---|
State | New |
Headers | show |
Series | arm64: Support HP Envy X2 | expand |
On Fri, Jan 25, 2019 at 12:45:16PM +0100, Alexander Graf wrote: > There are a few spots in the PE generation code for EFI binaries that uses > the section alignment rather than file alignment, even though the alignment > is really only file bound. > > Replace those cases with the file alignment constant instead. > > Reported-by: Daniel Kiper <dkiper@net-space.pl> > Signed-off-by: Alexander Graf <agraf@suse.de> Great! However, this patch misses changes for EFI32_HEADER_SIZE and EFI64_HEADER_SIZE macros. In general I think about s/GRUB_PE32_SECTION_ALIGNMENT/GRUB_PE32_FILE_ALIGNMENT/ I have asked about that in my earlier emails too... Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
On 28.01.19 13:27, Daniel Kiper wrote: > On Fri, Jan 25, 2019 at 12:45:16PM +0100, Alexander Graf wrote: >> There are a few spots in the PE generation code for EFI binaries that uses >> the section alignment rather than file alignment, even though the alignment >> is really only file bound. >> >> Replace those cases with the file alignment constant instead. >> >> Reported-by: Daniel Kiper <dkiper@net-space.pl> >> Signed-off-by: Alexander Graf <agraf@suse.de> > > Great! However, this patch misses changes for EFI32_HEADER_SIZE > and EFI64_HEADER_SIZE macros. In general I think about > s/GRUB_PE32_SECTION_ALIGNMENT/GRUB_PE32_FILE_ALIGNMENT/ > I have asked about that in my earlier emails too... If you have such a strong opinion, why don't you just simply do the patch and I review it? The way we're bouncing this back and forth is unproductive for both of us. Alex _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
On Mon, Jan 28, 2019 at 01:34:20PM +0100, Alexander Graf wrote: > On 28.01.19 13:27, Daniel Kiper wrote: > > On Fri, Jan 25, 2019 at 12:45:16PM +0100, Alexander Graf wrote: > >> There are a few spots in the PE generation code for EFI binaries that uses > >> the section alignment rather than file alignment, even though the alignment > >> is really only file bound. > >> > >> Replace those cases with the file alignment constant instead. > >> > >> Reported-by: Daniel Kiper <dkiper@net-space.pl> > >> Signed-off-by: Alexander Graf <agraf@suse.de> > > > > Great! However, this patch misses changes for EFI32_HEADER_SIZE > > and EFI64_HEADER_SIZE macros. In general I think about > > s/GRUB_PE32_SECTION_ALIGNMENT/GRUB_PE32_FILE_ALIGNMENT/ > > I have asked about that in my earlier emails too... > > If you have such a strong opinion, why don't you just simply do the > patch and I review it? The way we're bouncing this back and forth is > unproductive for both of us. Yes, I agree. However, I am asking you about that for quite long time. You do not object and you do not take into account this comment. So, I assume that you are missing it. If you would do one of above things earlier I would not chase you up until now. Just please read my comments more carefully. Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
diff --git a/util/mkimage.c b/util/mkimage.c index 16af12e0c..6631bfe45 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -1227,10 +1227,10 @@ grub_install_generate_image (const char *dir, const char *prefix, header_size = EFI64_HEADER_SIZE; reloc_addr = ALIGN_UP (header_size + core_size, - image_target->section_align); + GRUB_PE32_FILE_ALIGNMENT); pe_size = ALIGN_UP (reloc_addr + layout.reloc_size, - image_target->section_align); + GRUB_PE32_FILE_ALIGNMENT); pe_img = xmalloc (reloc_addr + layout.reloc_size); memset (pe_img, 0, header_size); memcpy ((char *) pe_img + header_size, core_img, core_size); @@ -1280,7 +1280,7 @@ grub_install_generate_image (const char *dir, const char *prefix, o->image_base = 0; o->section_alignment = grub_host_to_target32 (image_target->section_align); - o->file_alignment = grub_host_to_target32 (image_target->section_align); + o->file_alignment = grub_host_to_target32 (GRUB_PE32_FILE_ALIGNMENT); o->image_size = grub_host_to_target32 (pe_size); o->header_size = grub_host_to_target32 (header_size); o->subsystem = grub_host_to_target16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION); @@ -1315,7 +1315,7 @@ grub_install_generate_image (const char *dir, const char *prefix, o->code_base = grub_cpu_to_le32 (header_size); o->image_base = 0; o->section_alignment = grub_host_to_target32 (image_target->section_align); - o->file_alignment = grub_host_to_target32 (image_target->section_align); + o->file_alignment = grub_host_to_target32 (GRUB_PE32_FILE_ALIGNMENT); o->image_size = grub_host_to_target32 (pe_size); o->header_size = grub_host_to_target32 (header_size); o->subsystem = grub_host_to_target16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION);
There are a few spots in the PE generation code for EFI binaries that uses the section alignment rather than file alignment, even though the alignment is really only file bound. Replace those cases with the file alignment constant instead. Reported-by: Daniel Kiper <dkiper@net-space.pl> Signed-off-by: Alexander Graf <agraf@suse.de> --- util/mkimage.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.12.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel