!187 例行回合grub2软件包开源补丁
From: @zhangqiumiao Reviewed-by: @t_feng Signed-off-by: @t_feng
This commit is contained in:
commit
e31f0fa37e
@ -0,0 +1,56 @@
|
||||
From 01d1953fc50764206daad12d9b5dd68721353315 Mon Sep 17 00:00:00 2001
|
||||
From: Robbie Harwood <rharwood@redhat.com>
|
||||
Date: Thu, 18 Aug 2022 13:50:09 -0400
|
||||
Subject: commands/efi/efifwsetup: Add missing grub_free()s
|
||||
|
||||
Each call of grub_efi_get_variable() needs a grub_free().
|
||||
|
||||
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=01d1953fc50764206daad12d9b5dd68721353315
|
||||
Conflict:NA
|
||||
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/commands/efi/efifwsetup.c | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c
|
||||
index 328c45e..50cecb4 100644
|
||||
--- a/grub-core/commands/efi/efifwsetup.c
|
||||
+++ b/grub-core/commands/efi/efifwsetup.c
|
||||
@@ -33,17 +33,20 @@ efifwsetup_is_supported (void)
|
||||
grub_efi_uint64_t *os_indications_supported = NULL;
|
||||
grub_size_t oi_size = 0;
|
||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
+ grub_efi_boolean_t ret = 0;
|
||||
|
||||
grub_efi_get_variable ("OsIndicationsSupported", &global, &oi_size,
|
||||
(void **) &os_indications_supported);
|
||||
|
||||
if (!os_indications_supported)
|
||||
- return 0;
|
||||
+ goto done;
|
||||
|
||||
if (*os_indications_supported & GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI)
|
||||
- return 1;
|
||||
+ ret = 1;
|
||||
|
||||
- return 0;
|
||||
+ done:
|
||||
+ grub_free (os_indications_supported);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
@@ -67,6 +70,8 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)),
|
||||
if (old_os_indications != NULL && oi_size == sizeof (os_indications))
|
||||
os_indications |= *old_os_indications;
|
||||
|
||||
+ grub_free (old_os_indications);
|
||||
+
|
||||
status = grub_efi_set_variable ("OsIndications", &global, &os_indications,
|
||||
sizeof (os_indications));
|
||||
if (status != GRUB_ERR_NONE)
|
||||
--
|
||||
2.19.1
|
||||
|
||||
69
backport-fs-fat-Dont-error-when-mtime-is-0.patch
Normal file
69
backport-fs-fat-Dont-error-when-mtime-is-0.patch
Normal file
@ -0,0 +1,69 @@
|
||||
From e43f3d93b28cce852c110c7a8e40d8311bcd8bb1 Mon Sep 17 00:00:00 2001
|
||||
From: Robbie Harwood <rharwood@redhat.com>
|
||||
Date: Fri, 15 Jul 2022 16:13:02 -0400
|
||||
Subject: fs/fat: Don't error when mtime is 0
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
In the wild, we occasionally see valid ESPs where some file modification
|
||||
times are 0. For instance:
|
||||
|
||||
├── [Dec 31 1979] EFI
|
||||
│ ├── [Dec 31 1979] BOOT
|
||||
│ │ ├── [Dec 31 1979] BOOTX64.EFI
|
||||
│ │ └── [Dec 31 1979] fbx64.efi
|
||||
│ └── [Jun 27 02:41] fedora
|
||||
│ ├── [Dec 31 1979] BOOTX64.CSV
|
||||
│ ├── [Dec 31 1979] fonts
|
||||
│ ├── [Mar 14 03:35] fw
|
||||
│ │ ├── [Mar 14 03:35] fwupd-359c1169-abd6-4a0d-8bce-e4d4713335c1.cap
|
||||
│ │ ├── [Mar 14 03:34] fwupd-9d255c4b-2d88-4861-860d-7ee52ade9463.cap
|
||||
│ │ └── [Mar 14 03:34] fwupd-b36438d8-9128-49d2-b280-487be02d948b.cap
|
||||
│ ├── [Dec 31 1979] fwupdx64.efi
|
||||
│ ├── [May 10 10:47] grub.cfg
|
||||
│ ├── [Jun 3 12:38] grub.cfg.new.new
|
||||
│ ├── [May 10 10:41] grub.cfg.old
|
||||
│ ├── [Jun 27 02:41] grubenv
|
||||
│ ├── [Dec 31 1979] grubx64.efi
|
||||
│ ├── [Dec 31 1979] mmx64.efi
|
||||
│ ├── [Dec 31 1979] shim.efi
|
||||
│ ├── [Dec 31 1979] shimx64.efi
|
||||
│ └── [Dec 31 1979] shimx64-fedora.efi
|
||||
└── [Dec 31 1979] FSCK0000.REC
|
||||
|
||||
5 directories, 17 files
|
||||
|
||||
This causes grub-probe failure, which in turn causes grub-mkconfig
|
||||
failure. They are valid filesystems that appear intact, and the Linux
|
||||
FAT stack is able to mount and manipulate them without complaint.
|
||||
|
||||
The check for mtime of 0 has been present since
|
||||
20def1a3c3952982395cd7c3ea7e78638527962b (fat: support file
|
||||
modification times).
|
||||
|
||||
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=e43f3d93b28cce852c110c7a8e40d8311bcd8bb1
|
||||
Conflict:NA
|
||||
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/fs/fat.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c
|
||||
index 0951b2e..c5efed7 100644
|
||||
--- a/grub-core/fs/fat.c
|
||||
+++ b/grub-core/fs/fat.c
|
||||
@@ -1027,9 +1027,6 @@ grub_fat_dir (grub_device_t device, const char *path, grub_fs_dir_hook_t hook,
|
||||
grub_le_to_cpu16 (ctxt.dir.w_date),
|
||||
&info.mtime);
|
||||
#endif
|
||||
- if (info.mtimeset == 0)
|
||||
- grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
- "invalid modification timestamp for %s", path);
|
||||
|
||||
if (hook (ctxt.filename, &info, hook_data))
|
||||
break;
|
||||
--
|
||||
cgit v1.1
|
||||
@ -0,0 +1,49 @@
|
||||
From 92005be6d82b275e32bd74d1aabc45461e70db0d Mon Sep 17 00:00:00 2001
|
||||
From: Robbie Harwood <rharwood@redhat.com>
|
||||
Date: Fri, 15 Jul 2022 16:13:01 -0400
|
||||
Subject: kern/fs: The grub_fs_probe() should dprint errors from filesystems
|
||||
|
||||
When filesystem detection fails, all that's currently debug-logged is
|
||||
a series of messages like:
|
||||
|
||||
grub-core/kern/fs.c:56:fs: Detecting ntfs...
|
||||
grub-core/kern/fs.c:76:fs: ntfs detection failed.
|
||||
|
||||
repeated for each filesystem. Any messages provided to grub_error() by
|
||||
the filesystem are lost, and one has to break out gdb to figure out what
|
||||
went wrong.
|
||||
|
||||
With this change, one instead sees:
|
||||
|
||||
grub-core/kern/fs.c:56:fs: Detecting fat...
|
||||
grub-core/osdep/hostdisk.c:357:hostdisk: reusing open device
|
||||
`/path/to/device'
|
||||
grub-core/kern/fs.c:77:fs: error: invalid modification timestamp for /.
|
||||
grub-core/kern/fs.c:79:fs: fat detection failed.
|
||||
|
||||
in the debug prints.
|
||||
|
||||
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=92005be6d82b275e32bd74d1aabc45461e70db0d
|
||||
Conflict:NA
|
||||
|
||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/kern/fs.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c
|
||||
index e0d7e16..b950829 100644
|
||||
--- a/grub-core/kern/fs.c
|
||||
+++ b/grub-core/kern/fs.c
|
||||
@@ -75,6 +75,8 @@ grub_fs_probe (grub_device_t device)
|
||||
return p;
|
||||
|
||||
grub_error_push ();
|
||||
+ /* The grub_error_push() does not touch grub_errmsg. */
|
||||
+ grub_dprintf ("fs", _("error: %s.\n"), grub_errmsg);
|
||||
grub_dprintf ("fs", "%s detection failed.\n", p->name);
|
||||
grub_error_pop ();
|
||||
|
||||
--
|
||||
cgit v1.1
|
||||
@ -0,0 +1,40 @@
|
||||
From f7f453e0bf1043d89587638ffd24b8c34631b8eb Mon Sep 17 00:00:00 2001
|
||||
From: Ross Philipson <ross.philipson@oracle.com>
|
||||
Date: Thu, 14 Jul 2022 09:41:28 -0400
|
||||
Subject: lib/relocator: Initialize local relocator subchunk struct to all
|
||||
zeros
|
||||
|
||||
The way the code is written the tofree variable would never be passed to
|
||||
the free_subchunk() function uninitialized. Coverity cannot determine
|
||||
this and flags the situation as "Using uninitialized value...". The fix
|
||||
is just to initialize the local struct.
|
||||
|
||||
Fixes: CID 314016
|
||||
|
||||
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=f7f453e0bf1043d89587638ffd24b8c34631b8eb
|
||||
Conflict:NA
|
||||
|
||||
Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
|
||||
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Tested-by: Alec Brown <alec.r.brown@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/lib/relocator.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c
|
||||
index 68ef128..bfcc70d 100644
|
||||
--- a/grub-core/lib/relocator.c
|
||||
+++ b/grub-core/lib/relocator.c
|
||||
@@ -989,7 +989,7 @@ malloc_in_range (struct grub_relocator *rel,
|
||||
if (j != 0 && events[j - 1].pos != events[j].pos)
|
||||
{
|
||||
grub_addr_t alloc_start, alloc_end;
|
||||
- struct grub_relocator_subchunk tofree;
|
||||
+ struct grub_relocator_subchunk tofree = {0};
|
||||
struct grub_relocator_subchunk *curschu = &tofree;
|
||||
if (!oom)
|
||||
curschu = &res->subchunks[cural];
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
From 69edb31205602c29293a8c6e67363bba2a4a1e66 Mon Sep 17 00:00:00 2001
|
||||
From: Ard Biesheuvel <ardb@kernel.org>
|
||||
Date: Thu, 11 Aug 2022 16:51:57 +0200
|
||||
Subject: loader/arm64/linux: Remove magic number header field check
|
||||
|
||||
The "ARM\x64" magic number in the file header identifies an image as one
|
||||
that implements the bare metal boot protocol, allowing the loader to
|
||||
simply move the file to a suitably aligned address in memory, with
|
||||
sufficient headroom for the trailing .bss segment (the required memory
|
||||
size is described in the header as well).
|
||||
|
||||
Note of this matters for GRUB, as it only supports EFI boot. EFI does
|
||||
not care about this magic number, and nor should GRUB: this prevents us
|
||||
from booting other PE linux images, such as the generic EFI zboot
|
||||
decompressor, which is a pure PE/COFF image, and does not implement the
|
||||
bare metal boot protocol.
|
||||
|
||||
So drop the magic number check.
|
||||
|
||||
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=69edb31205602c29293a8c6e67363bba2a4a1e66
|
||||
Conflict:NA
|
||||
|
||||
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/loader/arm64/linux.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
|
||||
index d2af47c..c6db843 100644
|
||||
--- a/grub-core/loader/arm64/linux.c
|
||||
+++ b/grub-core/loader/arm64/linux.c
|
||||
@@ -55,9 +55,6 @@ static grub_addr_t initrd_end;
|
||||
grub_err_t
|
||||
grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh)
|
||||
{
|
||||
- if (lh->magic != GRUB_LINUX_ARMXX_MAGIC_SIGNATURE)
|
||||
- return grub_error(GRUB_ERR_BAD_OS, "invalid magic number");
|
||||
-
|
||||
if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
From 13fb5af10c835c32862e6c861fc655101e2917c7 Mon Sep 17 00:00:00 2001
|
||||
From: Glenn Washburn <development@efficientek.com>
|
||||
Date: Thu, 11 Aug 2022 12:48:42 -0500
|
||||
Subject: misc: Add cast in grub_strncasecmp() to drop sign when calling
|
||||
grub_tolower()
|
||||
|
||||
Note this cast was fixed in grub_strcasecmp() in commit ce41ab7aab
|
||||
(* grub-core/kern/misc.c (grub_strcmp): Use unsigned comparison as per
|
||||
common usage and preffered in several parts of code.), but this commit
|
||||
omitted fixing it in grub_strncasecmp().
|
||||
|
||||
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=13fb5af10c835c32862e6c861fc655101e2917c7
|
||||
Conflict:NA
|
||||
|
||||
Signed-off-by: Glenn Washburn <development@efficientek.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
include/grub/misc.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/grub/misc.h b/include/grub/misc.h
|
||||
index cf84aec..6c89a9e 100644
|
||||
--- a/include/grub/misc.h
|
||||
+++ b/include/grub/misc.h
|
||||
@@ -240,7 +240,8 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
||||
|
||||
while (*s1 && *s2 && --n)
|
||||
{
|
||||
- if (grub_tolower (*s1) != grub_tolower (*s2))
|
||||
+ if (grub_tolower ((grub_uint8_t) *s1)
|
||||
+ != grub_tolower ((grub_uint8_t) *s2))
|
||||
break;
|
||||
|
||||
s1++;
|
||||
--
|
||||
2.19.1
|
||||
|
||||
45
backport-util-grub-mkfont-Fix-resource-leaks.patch
Normal file
45
backport-util-grub-mkfont-Fix-resource-leaks.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 78baa77c01f88662d980be38250344f7379b6655 Mon Sep 17 00:00:00 2001
|
||||
From: Qiumiao Zhang <zhangqiumiao1@huawei.com>
|
||||
Date: Mon, 1 Aug 2022 16:31:02 +0800
|
||||
Subject: util/grub-mkfont: Fix resource leaks
|
||||
|
||||
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=78baa77c01f88662d980be38250344f7379b6655
|
||||
Conflict:NA
|
||||
|
||||
Signed-off-by: Qiumiao Zhang <zhangqiumiao1@huawei.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
util/grub-mkfont.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c
|
||||
index bb6982d..f63890c 100644
|
||||
--- a/util/grub-mkfont.c
|
||||
+++ b/util/grub-mkfont.c
|
||||
@@ -656,6 +656,7 @@ add_font (struct grub_font_info *font_info, FT_Face face, int nocut)
|
||||
}
|
||||
}
|
||||
}
|
||||
+ free (gsub);
|
||||
}
|
||||
|
||||
if (font_info->num_range)
|
||||
@@ -1279,11 +1280,15 @@ main (int argc, char *argv[])
|
||||
if (font_verbosity > 1)
|
||||
print_glyphs (&arguments.font_info);
|
||||
|
||||
+ free (arguments.font_info.glyphs_sorted);
|
||||
+
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < arguments.nfiles; i++)
|
||||
free (arguments.files[i]);
|
||||
}
|
||||
|
||||
+ free (arguments.files);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -265,3 +265,10 @@ Patch0265: backport-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch
|
||||
Patch0266: fix-compressed-kernel-verification-failed.patch
|
||||
Patch0267: backport-tests-Disable-blkid-cache-usage.patch
|
||||
Patch0268: backport-disk-efi-efidisk-Pass-buffers-with-higher-alignment.patch
|
||||
Patch0269: backport-lib-relocator-Initialize-local-relocator-subchunk-struct-to.patch
|
||||
Patch0270: backport-kern-fs-The-grub_fs_probe-should-dprint-errors.patch
|
||||
Patch0271: backport-fs-fat-Dont-error-when-mtime-is-0.patch
|
||||
Patch0272: backport-util-grub-mkfont-Fix-resource-leaks.patch
|
||||
Patch0273: backport-loader-arm64-linux-Remove-magic-number-header-field-.patch
|
||||
Patch0274: backport-misc-Add-cast-in-grub_strncasecmp-to-drop-sign-when-.patch
|
||||
Patch0275: backport-commands-efi-efifwsetup-Add-missing-grub_free-s.patch
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.06
|
||||
Release: 12
|
||||
Release: 13
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
@ -436,6 +436,12 @@ fi
|
||||
%{_datadir}/man/man*
|
||||
|
||||
%changelog
|
||||
* Sun Oct 23 2022 zhangqiumiao <zhangqiumiao1@huawei.com> - 1:2.06-13
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:backport some patches from upstream
|
||||
|
||||
* Tue Aug 30 2022 wanglu <wanglu210@huawei.com> - 1:2.06-12
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user