Skip to content

Commit

Permalink
[grub] Disable code optimization for ip frame checksum calculation. (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
gmileka authored Jun 14, 2024
1 parent 7791dfe commit c50d4af
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Summary: Signed GRand Unified Bootloader for %{buildarch} systems
Name: grub2-efi-binary-signed-%{buildarch}
Version: 2.06
Release: 18%{?dist}
Release: 19%{?dist}
License: GPLv3+
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand Down Expand Up @@ -79,6 +79,9 @@ cp %{SOURCE3} %{buildroot}/boot/efi/EFI/BOOT/%{grubpxeefiname}
/boot/efi/EFI/BOOT/%{grubpxeefiname}

%changelog
* Wed Jun 12 2024 George Mileka <gmileka@microsoft.com> - 2.06-19
- disable code optimization for ip checksum calculation

* Mon Apr 15 2024 Dan Streetman <ddstreet@microsoft.com> - 2.06-18
- update grub to sbat 4

Expand Down
12 changes: 12 additions & 0 deletions SPECS/grub2/disable-checksum-code-optimization.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -ruN grub-2.06-ori/grub-core/net/ip.c grub-2.06/grub-core/net/ip.c
--- grub-2.06-ori/grub-core/net/ip.c 2024-06-07 15:02:36.073464745 -0700
+++ grub-2.06/grub-core/net/ip.c 2024-06-12 19:02:51.293389116 -0700
@@ -94,7 +94,7 @@
static struct reassemble *reassembles;

grub_uint16_t
-grub_net_ip_chksum (void *ipv, grub_size_t len)
+__attribute__((optimize("O0"))) grub_net_ip_chksum (void *ipv, grub_size_t len)
{
grub_uint16_t *ip = (grub_uint16_t *) ipv;
grub_uint32_t sum = 0;
9 changes: 8 additions & 1 deletion SPECS/grub2/grub2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Summary: GRand Unified Bootloader
Name: grub2
Version: 2.06
Release: 18%{?dist}
Release: 19%{?dist}
License: GPLv3+
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand Down Expand Up @@ -103,6 +103,10 @@ Patch: sbat-4-0003-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri
Patch: sbat-4-0004-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch
Patch: sbat-4-0005-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch
Patch: sbat-4-0006-fs-ntfs-Make-code-more-readable.patch
# The Azure Linux team created this patch since the gcc version in use at the
# time optimizes the code incorrectly, leading to network traffic getting
# dropped in scenarios like PXE booting.
Patch: disable-checksum-code-optimization.patch
BuildRequires: autoconf
BuildRequires: device-mapper-devel
BuildRequires: python3
Expand Down Expand Up @@ -440,6 +444,9 @@ cp $GRUB_PXE_MODULE_SOURCE $EFI_BOOT_DIR/$GRUB_PXE_MODULE_NAME
%config(noreplace) %{_sysconfdir}/grub.d/41_custom

%changelog
* Wed Jun 12 2024 George Mileka <gmileka@microsoft.com> - 2.06-19
- disable code optimization for ip checksum calculation

* Mon Apr 15 2024 Dan Streetman <ddstreet@microsoft.com> - 2.06-18
- update grub to sbat 4

Expand Down

0 comments on commit c50d4af

Please sign in to comment.