From 75312220571a2c5de2b10109434a1dacccc947ab Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 3 Oct 2018 15:57:52 -0400 Subject: [PATCH] Fix the fallback counting script even harder. Apparently, this wasn't tested well enough. Resolves: rhbz#1614637 Signed-off-by: Peter Jones --- ...-Better-memory-allocation-and-error-.patch | 15 ++++++---- ...tter-locations-for-kernel-and-initrd.patch | 6 ++-- ...t-counting-grub.cfg-snippet-creation.patch | 0 ...loader-Better-memory-allocation-and-.patch | 24 --------------- ...fallback-counting-script-even-harder.patch | 29 +++++++++++++++++++ grub.patches | 4 +-- grub2.spec | 7 ++++- 7 files changed, 49 insertions(+), 36 deletions(-) rename 0255-Fix-boot-counting-grub.cfg-snippet-creation.patch => 0254-Fix-boot-counting-grub.cfg-snippet-creation.patch (100%) delete mode 100644 0254-fixup-arm-arm64-loader-Better-memory-allocation-and-.patch create mode 100644 0255-Fix-the-fallback-counting-script-even-harder.patch diff --git a/0238-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0238-arm-arm64-loader-Better-memory-allocation-and-error-.patch index a5cc064..3cf7d15 100644 --- a/0238-arm-arm64-loader-Better-memory-allocation-and-error-.patch +++ b/0238-arm-arm64-loader-Better-memory-allocation-and-error-.patch @@ -74,12 +74,12 @@ per-platform constraints on its given address are maintained. Signed-off-by: Peter Jones --- - grub-core/kern/efi/mm.c | 32 ++++++++++++----- + grub-core/kern/efi/mm.c | 35 ++++++++++++++----- grub-core/loader/arm64/linux.c | 78 ++++++++++++++++++++++++++++++++---------- - 2 files changed, 82 insertions(+), 28 deletions(-) + 2 files changed, 85 insertions(+), 28 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 7692e63ba24..306924f73a4 100644 +index 7692e63ba24..2c41a528f27 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -154,6 +154,7 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, @@ -90,7 +90,7 @@ index 7692e63ba24..306924f73a4 100644 /* Limit the memory access to less than 4GB for 32-bit platforms. */ if (address > GRUB_EFI_MAX_USABLE_ADDRESS) -@@ -165,19 +166,19 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, +@@ -165,19 +166,22 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, } b = grub_efi_system_table->boot_services; @@ -98,6 +98,9 @@ index 7692e63ba24..306924f73a4 100644 + status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &ret); if (status != GRUB_EFI_SUCCESS) { ++ grub_dprintf ("efi", ++ "allocate_pages(%d, %d, 0x%0lx, 0x%016lx) = 0x%016lx\n", ++ alloctype, memtype, pages, address, status); grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); return NULL; } @@ -114,7 +117,7 @@ index 7692e63ba24..306924f73a4 100644 grub_efi_free_pages (0, pages); if (status != GRUB_EFI_SUCCESS) { -@@ -186,9 +187,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, +@@ -186,9 +190,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, } } @@ -126,7 +129,7 @@ index 7692e63ba24..306924f73a4 100644 } void * -@@ -696,11 +697,24 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) +@@ -696,11 +700,24 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) if (ret < 1) return GRUB_ERR_BUG; diff --git a/0239-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0239-Try-to-pick-better-locations-for-kernel-and-initrd.patch index 2061a45..6ae1981 100644 --- a/0239-Try-to-pick-better-locations-for-kernel-and-initrd.patch +++ b/0239-Try-to-pick-better-locations-for-kernel-and-initrd.patch @@ -34,7 +34,7 @@ Signed-off-by: Peter Jones 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 306924f73a4..a553f817edb 100644 +index 2c41a528f27..cac775fc935 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -122,7 +122,7 @@ grub_efi_allocate_pages_max (grub_efi_physical_address_t max, @@ -46,7 +46,7 @@ index 306924f73a4..a553f817edb 100644 return 0; b = grub_efi_system_table->boot_services; -@@ -463,7 +463,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, +@@ -466,7 +466,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, { if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY #if 1 @@ -55,7 +55,7 @@ index 306924f73a4..a553f817edb 100644 #endif && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000 && desc->num_pages != 0) -@@ -481,9 +481,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, +@@ -484,9 +484,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, #if 1 if (BYTES_TO_PAGES (filtered_desc->physical_start) + filtered_desc->num_pages diff --git a/0255-Fix-boot-counting-grub.cfg-snippet-creation.patch b/0254-Fix-boot-counting-grub.cfg-snippet-creation.patch similarity index 100% rename from 0255-Fix-boot-counting-grub.cfg-snippet-creation.patch rename to 0254-Fix-boot-counting-grub.cfg-snippet-creation.patch diff --git a/0254-fixup-arm-arm64-loader-Better-memory-allocation-and-.patch b/0254-fixup-arm-arm64-loader-Better-memory-allocation-and-.patch deleted file mode 100644 index 83f1b55..0000000 --- a/0254-fixup-arm-arm64-loader-Better-memory-allocation-and-.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 2 Oct 2018 13:26:42 -0400 -Subject: [PATCH] fixup! arm/arm64 loader: Better memory allocation and error - messages. - ---- - grub-core/kern/efi/mm.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index a553f817edb..cac775fc935 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -169,6 +169,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, - status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &ret); - if (status != GRUB_EFI_SUCCESS) - { -+ grub_dprintf ("efi", -+ "allocate_pages(%d, %d, 0x%0lx, 0x%016lx) = 0x%016lx\n", -+ alloctype, memtype, pages, address, status); - grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); - return NULL; - } diff --git a/0255-Fix-the-fallback-counting-script-even-harder.patch b/0255-Fix-the-fallback-counting-script-even-harder.patch new file mode 100644 index 0000000..a478685 --- /dev/null +++ b/0255-Fix-the-fallback-counting-script-even-harder.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 3 Oct 2018 15:53:18 -0400 +Subject: [PATCH] Fix the fallback counting script even harder. + +Apparently, this wasn't tested well enough. + +Resolves: rhbz#1614637 +Signed-off-by: Peter Jones +--- + util/grub.d/01_fallback_counting.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in +index afe06199a93..31e8981887b 100644 +--- a/util/grub.d/01_fallback_counting.in ++++ b/util/grub.d/01_fallback_counting.in +@@ -7,8 +7,8 @@ if [ "\${boot_counter}" -a "\${boot_success}" = "0" ]; then + set default=1 + set boot_counter=-1 + else +- set boot_counter=$((\${boot_counter}-1)) ++ set boot_counter=\$((\${boot_counter}-1)) + fi + save_env boot_counter + fi +-EOF +\ No newline at end of file ++EOF diff --git a/grub.patches b/grub.patches index 4ca54c8..b520493 100644 --- a/grub.patches +++ b/grub.patches @@ -251,5 +251,5 @@ Patch0250: 0250-Include-blscfg-module-for-powerpc-ieee1275.patch Patch0251: 0251-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch Patch0252: 0252-Fix-getroot.c-s-trampolines.patch Patch0253: 0253-Do-not-allow-stack-trampolines-anywhere.patch -Patch0254: 0254-fixup-arm-arm64-loader-Better-memory-allocation-and-.patch -Patch0255: 0255-Fix-boot-counting-grub.cfg-snippet-creation.patch +Patch0254: 0254-Fix-boot-counting-grub.cfg-snippet-creation.patch +Patch0255: 0255-Fix-the-fallback-counting-script-even-harder.patch diff --git a/grub2.spec b/grub2.spec index a9708de..e57947e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 60%{?dist} +Release: 61%{?dist} Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base License: GPLv3+ @@ -494,6 +494,11 @@ fi %endif %changelog +* Wed Oct 03 2018 Peter Jones - 2.02-61 +- Fix the fallback counting script even harder. Apparently, this wasn't + tested well enough. + Resolves: rhbz#1614637 + * Tue Oct 02 2018 Peter Jones - 2.02-60 - Fix grub.cfg boot counting snippet generation (lorbus) Resolves: rhbz#1614637