Fix the fallback counting script even harder. Apparently, this wasn't

tested well enough.
  Resolves: rhbz#1614637

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2018-10-03 15:57:52 -04:00
parent a3bfe35d12
commit 7531222057
7 changed files with 49 additions and 36 deletions

View File

@ -74,12 +74,12 @@ per-platform constraints on its given address are maintained.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
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;

View File

@ -34,7 +34,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
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

View File

@ -1,24 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
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;
}

View File

@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
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 <pjones@redhat.com>
---
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

View File

@ -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

View File

@ -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 <pjones@redhat.com> - 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 <pjones@redhat.com> - 2.02-60
- Fix grub.cfg boot counting snippet generation (lorbus)
Resolves: rhbz#1614637