Skip to content
Snippets Groups Projects
Commit 16895d90 authored by Steve McIntyre's avatar Steve McIntyre
Browse files

Switch build-deps from gcc-10 to gcc-12. Closes: #1022184

Also needs backports from upstream commits to fix warnings/errors
from using gcc 12:

be8eb0eed util/mkimage: Fix dangling pointer may be used error
acffb8148 build: Fix -Werror=array-bounds array subscript 0 is outside array bounds
3ce13d974 lib/reed_solomon: Fix array subscript 0 is outside array bounds
parent 552fb313
No related merge requests found
...@@ -5,6 +5,7 @@ grub2 (2.06-8) UNRELEASED; urgency=medium ...@@ -5,6 +5,7 @@ grub2 (2.06-8) UNRELEASED; urgency=medium
* Fix an issue in an f2fs security fix which caused mount * Fix an issue in an f2fs security fix which caused mount
failures. Closes: #1021846. Thanks to программист некто for helping failures. Closes: #1021846. Thanks to программист некто for helping
to debug the problem! to debug the problem!
* Switch build-deps from gcc-10 to gcc-12. Closes: #1022184
-- Steve McIntyre <93sam@debian.org> Sun, 11 Dec 2022 12:08:44 +0000 -- Steve McIntyre <93sam@debian.org> Sun, 11 Dec 2022 12:08:44 +0000
......
...@@ -11,8 +11,8 @@ Build-Depends: debhelper-compat (= 13), ...@@ -11,8 +11,8 @@ Build-Depends: debhelper-compat (= 13),
po-debconf, po-debconf,
help2man, help2man,
texinfo, texinfo,
gcc-10, gcc-12,
gcc-10-multilib [i386 kopensolaris-i386 any-amd64 any-ppc64 any-sparc], gcc-12-multilib [i386 kopensolaris-i386 any-amd64 any-ppc64 any-sparc],
xfonts-unifont, xfonts-unifont,
libfreetype6-dev, libfreetype6-dev,
gettext, gettext,
......
This diff is collapsed.
commit 3ce13d974b887338ae972c79b41ff6fc0eee6388
Author: Michael Chang <mchang@suse.com>
Date: Mon Mar 28 15:00:54 2022 +0800
lib/reed_solomon: Fix array subscript 0 is outside array bounds
The grub_absolute_pointer() is a compound expression that can only work
within a function. We are out of luck here when the pointer variables
require global definition due to ATTRIBUTE_TEXT that have to use fully
initialized global definition because of the way linkers work.
static gf_single_t * const gf_powx ATTRIBUTE_TEXT = (void *) 0x100000;
For the reason given above, use GCC diagnostic pragmas to suppress the
array-bounds warning.
Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c
index 82779a296..562bd2e3e 100644
--- a/grub-core/lib/reed_solomon.c
+++ b/grub-core/lib/reed_solomon.c
@@ -102,6 +102,11 @@ static gf_single_t errvals[256];
static gf_single_t eqstat[65536 + 256];
#endif
+#if __GNUC__ == 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+
static gf_single_t
gf_mul (gf_single_t a, gf_single_t b)
{
@@ -319,6 +324,10 @@ decode_block (gf_single_t *ptr, grub_size_t s,
}
}
+#if __GNUC__ == 12
+#pragma GCC diagnostic pop
+#endif
+
#if !defined (STANDALONE)
static void
encode_block (gf_single_t *ptr, grub_size_t s,
Borrowed and tweaked fix from:
commit be8eb0eed69f8bc9ac20837eae58e55218011880
Author: Michael Chang <mchang@suse.com>
Date: Mon Mar 28 15:00:52 2022 +0800
util/mkimage: Fix dangling pointer may be used error
diff --git a/util/mkimage.c b/util/mkimage.c
index a26cf76f7..58c199f7c 100644
--- a/util/mkimage 2022-12-11 15:41:56.717934782 +0000
+++ b/util/mkimage.c 2022-12-11 15:43:05.318432532 +0000
@@ -1383,6 +1383,10 @@
section = (struct grub_pe32_section_table *)(o64 + 1);
}
+#if __GNUC__ >= 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
PE_OHDR (o32, o64, header_size) = grub_host_to_target32 (header_size);
PE_OHDR (o32, o64, entry_addr) = grub_host_to_target32 (layout.start_address);
PE_OHDR (o32, o64, image_base) = 0;
@@ -1402,6 +1406,9 @@
/* The sections. */
PE_OHDR (o32, o64, code_base) = grub_host_to_target32 (vma);
PE_OHDR (o32, o64, code_size) = grub_host_to_target32 (layout.exec_size);
+#if __GNUC__ >= 12
+#pragma GCC diagnostic pop
+#endif
section = init_pe_section (image_target, section, ".text",
&vma, layout.exec_size,
image_target->section_align,
@@ -1413,10 +1420,17 @@
raw_size = layout.kernel_size - layout.exec_size;
scn_size = ALIGN_UP (raw_size, GRUB_PE32_FILE_ALIGNMENT);
/* ALIGN_UP (sbat_size, GRUB_PE32_FILE_ALIGNMENT) is done earlier. */
+#if __GNUC__ >= 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
PE_OHDR (o32, o64, data_size) = grub_host_to_target32 (scn_size + sbat_size +
ALIGN_UP (total_module_size,
GRUB_PE32_FILE_ALIGNMENT));
+#if __GNUC__ >= 12
+#pragma GCC diagnostic pop
+#endif
section = init_pe_section (image_target, section, ".data",
&vma, scn_size, image_target->section_align,
&raw_data, raw_size,
@@ -1448,8 +1462,15 @@
}
scn_size = ALIGN_UP (layout.reloc_size, GRUB_PE32_FILE_ALIGNMENT);
+#if __GNUC__ >= 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
PE_OHDR (o32, o64, base_relocation_table.rva) = grub_host_to_target32 (vma);
PE_OHDR (o32, o64, base_relocation_table.size) = grub_host_to_target32 (scn_size);
+#if __GNUC__ >= 12
+#pragma GCC diagnostic pop
+#endif
memcpy (pe_img + raw_data, layout.reloc_section, scn_size);
init_pe_section (image_target, section, ".reloc",
&vma, scn_size, image_target->section_align,
...@@ -107,3 +107,6 @@ cve_2022_2601/0013-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch ...@@ -107,3 +107,6 @@ cve_2022_2601/0013-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch
cve_2022_2601/0014-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch cve_2022_2601/0014-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch
font-Try-opening-fonts-from-the-bundled-memdisk.patch font-Try-opening-fonts-from-the-bundled-memdisk.patch
kern-file-Fix-error-handling-in-grub_file_open.patch kern-file-Fix-error-handling-in-grub_file_open.patch
gcc12_build_dangling_pointer.patch
gcc12_build_array_bounds.patch
gcc12_build_array_bounds2.patch
...@@ -37,7 +37,7 @@ else ...@@ -37,7 +37,7 @@ else
with_check := yes with_check := yes
endif endif
CC := gcc-10 CC := gcc-12
confflags = \ confflags = \
PACKAGE_VERSION="$(deb_version)" PACKAGE_STRING="GRUB $(deb_version)" \ PACKAGE_VERSION="$(deb_version)" PACKAGE_STRING="GRUB $(deb_version)" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment