kumquat-buildroot/boot/grub2
Stefan Sørensen 1bad507220 boot/grub2: Backport 2021/03/02 securify fixes
Details: https://lists.gnu.org/archive/html/grub-devel/2021-03/msg00007.html

As detailed in commit 7e64a050fb, it is
difficult to utilize the upstream patches directly, so a number of
patches include changes to generated files so that we don't need invoke
the gentpl.py script.

In addition to the security fixes, these required patches has been
backported:

  f76a27996 efi: Make shim_lock GUID and protocol type public
  04ae030d0 efi: Return grub_efi_status_t from grub_efi_get_variable()
  ac5c93675 efi: Add a function to read EFI variables with attributes
  d7e54b2e5 efi: Add secure boot detection

The following security issues are fixed:

CVE-2020-14372 grub2: The acpi command allows privileged user to load crafted
               ACPI tables when Secure Boot is enabled
CWE-184
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

GRUB2 enables the use of the command acpi even when Secure Boot is signaled by
the firmware. An attacker with local root privileges to can drop a small SSDT
in /boot/efi and modify grub.cfg to instruct grub to load said SSDT. The SSDT
then gets run by the kernel and it overwrites the kernel lock down configuration
enabling the attacker to load unsigned kernel modules and kexec unsigned code.

Reported-by: Máté Kukri

*******************************************************************************

CVE-2020-25632 grub2: Use-after-free in rmmod command
CWE-416
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

The rmmod implementation for GRUB2 is flawed, allowing an attacker to unload
a module used as dependency without checking if any other dependent module is
still loaded. This leads to an use-after-free scenario possibly allowing an
attacker to execute arbitrary code and by-pass Secure Boot protections.

Reported-by: Chris Coulson (Canonical)

*******************************************************************************

CVE-2020-25647 grub2: Out-of-bound write in grub_usb_device_initialize()
CWE-787
6.9/CVSS:3.1/AV:P/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

grub_usb_device_initialize() is called to handle USB device initialization. It
reads out the descriptors it needs from the USB device and uses that data to
fill in some USB data structures. grub_usb_device_initialize() performs very
little bounds checking and simply assumes the USB device provides sane values.
This behavior can trigger memory corruption. If properly exploited, this would
lead to arbitrary code execution allowing the attacker to by-pass Secure Boot
mechanism.

Reported-by: Joseph Tartaro (IOActive) and Ilja van Sprundel (IOActive)

*******************************************************************************

CVE-2020-27749 grub2: Stack buffer overflow in grub_parser_split_cmdline
CWE-121
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

grub_parser_split_cmdline() expands variable names present in the supplied
command line in to their corresponding variable contents and uses a 1kB stack
buffer for temporary storage without sufficient bounds checking. If the
function is called with a command line that references a variable with a
sufficiently large payload, it is possible to overflow the stack buffer,
corrupt the stack frame and control execution. An attacker may use this to
circumvent Secure Boot protections.

Reported-by: Chris Coulson (Canonical)

*******************************************************************************

CVE-2020-27779 grub2: The cutmem command allows privileged user to remove
               memory regions when Secure Boot is enabled
CWE-285
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

The GRUB2's cutmem command does not honor Secure Boot locking. This allows an
privileged attacker to remove address ranges from memory creating an
opportunity to circumvent Secure Boot protections after proper triage about
grub's memory layout.

Reported-by: Teddy Reed

*******************************************************************************

CVE-2021-3418 - grub2: GRUB 2.05 reintroduced CVE-2020-15705
CWE-281
6.4/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H

The GRUB2 upstream reintroduced the CVE-2020-15705. This refers to a distro
specific flaw which made upstream in the mentioned version.

If certificates that signed GRUB2 are installed into db, GRUB2 can be booted
directly. It will then boot any kernel without signature validation. The booted
kernel will think it was booted in Secure Boot mode and will implement lock
down, yet it could have been tampered.

This flaw only affects upstream and distributions using the shim_lock verifier.

Reported-by: Dimitri John Ledkov (Canonical)

*******************************************************************************

CVE-2021-20225 grub2: Heap out-of-bounds write in short form option parser
CWE-787
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

The option parser in GRUB2 allows an attacker to write past the end of
a heap-allocated buffer by calling certain commands with a large number
of specific short forms of options.

Reported-by: Daniel Axtens (IBM)

*******************************************************************************

CVE-2021-20233 grub2: Heap out-of-bound write due to mis-calculation of
               space required for quoting
CWE-787
7.5/CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H

There's a flaw on GRUB2 menu rendering code setparam_prefix() in the menu
rendering code performs a length calculation on the assumption that expressing
a quoted single quote will require 3 characters, while it actually requires
4 characters. This allow an attacker to corrupt memory by one byte for each
quote in the input.

Reported-by: Daniel Axtens (IBM)

*******************************************************************************

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-03-14 08:24:24 +01:00
..
0001-build-Fix-GRUB-i386-pc-build-with-Ubuntu-gcc.patch boot/grub2: Fix GRUB i386-pc build with Ubuntu gcc 2020-06-05 00:03:30 +02:00
0002-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0003-safemath-Add-some-arithmetic-primitives-that-check-f.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0004-calloc-Make-sure-we-always-have-an-overflow-checking.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0005-calloc-Use-calloc-at-most-places.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0006-malloc-Use-overflow-checking-primitives-where-we-do-.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0007-iso9660-Don-t-leak-memory-on-realloc-failures.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0008-font-Do-not-load-more-than-one-NAME-section.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0009-gfxmenu-Fix-double-free-in-load_image.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0010-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0011-lzma-Make-sure-we-don-t-dereference-past-array.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0012-term-Fix-overflow-on-user-inputs.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0013-udf-Fix-memory-leak.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0014-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0015-tftp-Do-not-use-priority-queue.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0016-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0017-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0018-script-Remove-unused-fields-from-grub_script_functio.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0019-script-Avoid-a-use-after-free-when-redefining-a-func.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0020-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0021-hfsplus-Fix-two-more-overflows.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0022-lvm-Fix-two-more-potential-data-dependent-alloc-over.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0023-emu-Make-grub_free-NULL-safe.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0024-efi-Fix-some-malformed-device-path-arithmetic-errors.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0025-efi-chainloader-Propagate-errors-from-copy_file_path.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0026-efi-Fix-use-after-free-in-halt-reboot-path.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0027-loader-linux-Avoid-overflow-on-initrd-size-calculati.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0028-linux-Fix-integer-overflows-in-initrd-size-handling.patch boot/grub2: Backport Boothole securify fixes 2020-08-03 13:38:49 +02:00
0029-efi-Make-shim_lock-GUID-and-protocol-type-public.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0030-efi-Return-grub_efi_status_t-from-grub_efi_get_varia.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0031-efi-Add-a-function-to-read-EFI-variables-with-attrib.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0032-efi-Add-secure-boot-detection.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0033-verifiers-Move-verifiers-API-to-kernel-image.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0034-efi-Move-the-shim_lock-verifier-to-the-GRUB-core.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0035-kern-Add-lockdown-support.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0036-kern-lockdown-Set-a-variable-if-the-GRUB-is-locked-d.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0037-efi-Lockdown-the-GRUB-when-the-UEFI-Secure-Boot-is-e.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0038-efi-Use-grub_is_lockdown-instead-of-hardcoding-a-dis.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0039-acpi-Don-t-register-the-acpi-command-when-locked-dow.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0040-mmap-Don-t-register-cutmem-and-badram-commands-when-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0041-commands-Restrict-commands-that-can-load-BIOS-or-DT-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0042-commands-setpci-Restrict-setpci-command-when-locked-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0043-commands-hdparm-Restrict-hdparm-command-when-locked-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0044-gdb-Restrict-GDB-access-when-locked-down.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0045-loader-xnu-Don-t-allow-loading-extension-and-package.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0046-docs-Document-the-cutmem-command.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0047-dl-Only-allow-unloading-modules-that-are-not-depende.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0048-usb-Avoid-possible-out-of-bound-accesses-caused-by-m.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0049-mmap-Fix-memory-leak-when-iterating-over-mapped-memo.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0050-net-net-Fix-possible-dereference-to-of-a-NULL-pointe.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0051-net-tftp-Fix-dangling-memory-pointer.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0052-kern-parser-Fix-resource-leak-if-argc-0.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0053-kern-efi-Fix-memory-leak-on-failure.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0054-kern-efi-mm-Fix-possible-NULL-pointer-dereference.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0055-gnulib-regexec-Resolve-unused-variable.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0056-gnulib-regcomp-Fix-uninitialized-token-structure.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0057-gnulib-argp-help-Fix-dereference-of-a-possibly-NULL-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0058-gnulib-regexec-Fix-possible-null-dereference.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0059-gnulib-regcomp-Fix-uninitialized-re_token.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0060-io-lzopio-Resolve-unnecessary-self-assignment-errors.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0061-zstd-Initialize-seq_t-structure-fully.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0062-kern-partition-Check-for-NULL-before-dereferencing-i.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0063-disk-ldm-Make-sure-comp-data-is-freed-before-exiting.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0064-disk-ldm-If-failed-then-free-vg-variable-too.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0065-disk-ldm-Fix-memory-leak-on-uninserted-lv-references.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0066-disk-cryptodisk-Fix-potential-integer-overflow.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0067-hfsplus-Check-that-the-volume-name-length-is-valid.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0068-zfs-Fix-possible-negative-shift-operation.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0069-zfs-Fix-resource-leaks-while-constructing-path.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0070-zfs-Fix-possible-integer-overflows.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0071-zfsinfo-Correct-a-check-for-error-allocating-memory.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0072-affs-Fix-memory-leaks.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0073-libgcrypt-mpi-Fix-possible-unintended-sign-extension.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0074-libgcrypt-mpi-Fix-possible-NULL-dereference.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0075-syslinux-Fix-memory-leak-while-parsing.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0076-normal-completion-Fix-leaking-of-memory-when-process.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0077-commands-hashsum-Fix-a-memory-leak.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0079-video-efi_gop-Remove-unnecessary-return-value-of-gru.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0080-video-fb-fbfill-Fix-potential-integer-overflow.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0081-video-fb-video_fb-Fix-multiple-integer-overflows.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0082-video-fb-video_fb-Fix-possible-integer-overflow.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0083-video-readers-jpeg-Test-for-an-invalid-next-marker-r.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0084-gfxmenu-gui_list-Remove-code-that-coverity-is-flaggi.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0085-loader-bsd-Check-for-NULL-arg-up-front.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0086-loader-xnu-Fix-memory-leak.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0087-loader-xnu-Free-driverkey-data-when-an-error-is-dete.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0088-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0089-util-grub-install-Fix-NULL-pointer-dereferences.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0090-util-grub-editenv-Fix-incorrect-casting-of-a-signed-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0091-util-glue-efi-Fix-incorrect-use-of-a-possibly-negati.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0092-script-execute-Fix-NULL-dereference-in-grub_script_e.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0093-commands-ls-Require-device_name-is-not-NULL-before-p.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0094-script-execute-Avoid-crash-when-using-outside-a-func.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0095-lib-arg-Block-repeated-short-options-that-require-an.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0096-script-execute-Don-t-crash-on-a-for-loop-with-no-ite.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0097-commands-menuentry-Fix-quoting-in-setparams_prefix.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0098-kern-misc-Always-set-end-in-grub_strtoull.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0099-video-readers-jpeg-Catch-files-with-unsupported-quan.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0100-video-readers-jpeg-Catch-OOB-reads-writes-in-grub_jp.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0101-video-readers-jpeg-Don-t-decode-data-before-start-of.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0102-term-gfxterm-Don-t-set-up-a-font-with-glyphs-that-ar.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0103-fs-fshelp-Catch-impermissibly-large-block-sizes-in-r.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0104-fs-hfsplus-Don-t-fetch-a-key-beyond-the-end-of-the-n.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0105-fs-hfsplus-Don-t-use-uninitialized-data-on-corrupt-f.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0106-fs-hfs-Disable-under-lockdown.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0107-fs-sfs-Fix-over-read-of-root-object-name.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0108-fs-jfs-Do-not-move-to-leaf-level-if-name-length-is-n.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0109-fs-jfs-Limit-the-extents-that-getblk-can-consider.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0110-fs-jfs-Catch-infinite-recursion.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0111-fs-nilfs2-Reject-too-large-keys.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0112-fs-nilfs2-Don-t-search-children-if-provided-number-i.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0113-fs-nilfs2-Properly-bail-on-errors-in-grub_nilfs2_btr.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0114-io-gzio-Bail-if-gzio-tl-td-is-NULL.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0115-io-gzio-Add-init_dynamic_block-clean-up-if-unpacking.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0116-io-gzio-Catch-missing-values-in-huft_build-and-bail.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0117-io-gzio-Zero-gzio-tl-td-in-init_dynamic_block-if-huf.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0118-disk-lvm-Don-t-go-beyond-the-end-of-the-data-we-read.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0119-disk-lvm-Don-t-blast-past-the-end-of-the-circular-me.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0120-disk-lvm-Bail-on-missing-PV-list.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0121-disk-lvm-Do-not-crash-if-an-expected-string-is-not-f.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0122-disk-lvm-Do-not-overread-metadata.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0123-disk-lvm-Sanitize-rlocn-offset-to-prevent-wild-read.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0124-disk-lvm-Do-not-allow-a-LV-to-be-it-s-own-segment-s-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0125-fs-btrfs-Validate-the-number-of-stripes-parities-in-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0126-fs-btrfs-Squash-some-uninitialized-reads.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0127-kern-parser-Fix-a-memory-leak.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0128-kern-parser-Introduce-process_char-helper.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0129-kern-parser-Introduce-terminate_arg-helper.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0130-kern-parser-Refactor-grub_parser_split_cmdline-clean.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0131-kern-buffer-Add-variable-sized-heap-buffer.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0132-kern-parser-Fix-a-stack-buffer-overflow.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0133-kern-efi-Add-initial-stack-protector-implementation.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0134-util-mkimage-Remove-unused-code-to-add-BSS-section.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0135-util-mkimage-Use-grub_host_to_target32-instead-of-gr.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0136-util-mkimage-Always-use-grub_host_to_target32-to-ini.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0137-util-mkimage-Unify-more-of-the-PE32-and-PE32-header-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0138-util-mkimage-Reorder-PE-optional-header-fields-set-u.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0139-util-mkimage-Improve-data_size-value-calculation.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0140-util-mkimage-Refactor-section-setup-to-use-a-helper.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0141-util-mkimage-Add-an-option-to-import-SBAT-metadata-i.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0142-grub-install-common-Add-sbat-option.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0143-shim_lock-Only-skip-loading-shim_lock-verifier-with-.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0144-kern-misc-Split-parse_printf_args-into-format-parsin.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0145-kern-misc-Add-STRING-type-for-internal-printf-format.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0146-kern-misc-Add-function-to-check-printf-format-agains.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0147-gfxmenu-gui-Check-printf-format-in-the-gui_progress_.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0148-templates-Disable-the-os-prober-by-default.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
0149-kern-mm-Fix-grub_debug_calloc-compilation-error.patch boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
Config.in boot/grub2: enable support for arm and aarch64 targets 2018-11-26 21:08:13 +01:00
grub2.hash boot/grub2: bump to verson 2.04 2019-09-21 23:15:27 +02:00
grub2.mk boot/grub2: Backport 2021/03/02 securify fixes 2021-03-14 08:24:24 +01:00
grub.cfg boot/grub2: add rootwait to default config 2016-03-10 22:21:35 +01:00
readme.txt grub2: add usage notes for grub2 arm and aarch64 2018-11-26 22:11:07 +01:00

Notes on using Grub2 for BIOS-based platforms
=============================================

1. Create a disk image
   dd if=/dev/zero of=disk.img bs=1M count=32
2. Partition it (either legacy or GPT style partitions work)
   cfdisk disk.img
    - Create one partition, type Linux, for the root
      filesystem. The only constraint is to make sure there
      is enough free space *before* the first partition to
      store Grub2. Leaving 1 MB of free space is safe.
3. Setup loop device and loop partitions
   sudo losetup -f disk.img
   sudo partx -a /dev/loop0
4. Prepare the root partition
   sudo mkfs.ext3 -L root /dev/loop0p1
   sudo mount /dev/loop0p1 /mnt
   sudo tar -C /mnt -xf output/images/rootfs.tar
   sudo umount /mnt
5. Install Grub2
   sudo ./output/host/sbin/grub-bios-setup \
        -b ./output/host/lib/grub/i386-pc/boot.img \
        -c ./output/images/grub.img -d . /dev/loop0
6. Cleanup loop device
   sudo partx -d /dev/loop0
   sudo losetup -d /dev/loop0
7. Your disk.img is ready!

Using genimage
--------------

If you use genimage to generate your complete image,
installing Grub can be tricky. Here is how to achieve Grub's
installation with genimage:

partition boot {
    in-partition-table = "no"
    image = "path_to_boot.img"
    offset = 0
    size = 512
}
partition grub {
    in-partition-table = "no"
    image = "path_to_grub.img"
    offset = 512
}

The result is not byte to byte identical to what
grub-bios-setup does but it works anyway.

To test your BIOS image in Qemu
-------------------------------

qemu-system-{i386,x86-64} -hda disk.img

Notes on using Grub2 for x86/x86_64 EFI-based platforms
=======================================================

1. Create a disk image
   dd if=/dev/zero of=disk.img bs=1M count=32
2. Partition it with GPT partitions
   cgdisk disk.img
    - Create a first partition, type EF00, for the
      bootloader and kernel image
    - Create a second partition, type 8300, for the root
      filesystem.
3. Setup loop device and loop partitions
   sudo losetup -f disk.img
   sudo partx -a /dev/loop0
4. Prepare the boot partition
   sudo mkfs.vfat -n boot /dev/loop0p1
   sudo mount /dev/loop0p1 /mnt
   sudo cp -a output/images/efi-part/* /mnt/
   sudo cp output/images/bzImage /mnt/
   sudo umount /mnt
5. Prepare the root partition
   sudo mkfs.ext3 -L root /dev/loop0p2
   sudo mount /dev/loop0p2 /mnt
   sudo tar -C /mnt -xf output/images/rootfs.tar
   sudo umount /mnt
6  Cleanup loop device
   sudo partx -d /dev/loop0
   sudo losetup -d /dev/loop0
7. Your disk.img is ready!

To test your i386/x86-64 EFI image in Qemu
------------------------------------------

1. Download the EFI BIOS for Qemu
   Version IA32 or X64 depending on the chosen Grub2
   platform (i386-efi vs. x86-64-efi)
   https://www.kraxel.org/repos/jenkins/edk2/
   (or use one provided by your distribution as OVMF)
2. Extract, and rename OVMF.fd to bios.bin and
   CirrusLogic5446.rom to vgabios-cirrus.bin.
3. qemu-system-{i386,x86-64} -L ovmf-dir/ -hda disk.img
4. Make sure to pass pci=nocrs to the kernel command line,
   to workaround a bug in the EFI BIOS regarding the
   EFI framebuffer.

Notes on using Grub2 for ARM u-boot-based platforms
===================================================

The following steps show how to use the Grub2 arm-uboot platform
support in the simplest way possible and with a single
buildroot-generated filesystem.

 1. Load qemu_arm_vexpress_defconfig

 2. Enable u-boot with the vexpress_ca9x4 board name and with
    u-boot.elf image format.

 3. Enable grub2 for the arm-uboot platform.

 4. Enable "Install kernel image to /boot in target" in the kernel
    menu to populate a /boot directory with zImage in it.

 5. The upstream u-boot vexpress_ca9x4 doesn't have CONFIG_API enabled
    by default, which is required.

    Before building, patch u-boot (for example, make u-boot-extract to
    edit the source before building) file
    include/configs/vexpress_common.h to define:

    #define CONFIG_API
    #define CONFIG_SYS_MMC_MAX_DEVICE   1

 6. Create a custom grub2 config file with the following contents and
    set its path in BR2_TARGET_GRUB2_CFG:

    set default="0"
    set timeout="5"

    menuentry "Buildroot" {
        set root='(hd0)'
        linux /boot/zImage root=/dev/mmcblk0 console=ttyAMA0
        devicetree /boot/vexpress-v2p-ca9.dtb
    }

 7. Create a custom builtin config file with the following contents
    and set its path in BR2_TARGET_GRUB2_BUILTIN_CONFIG:

    set root=(hd0)
    set prefix=/boot/grub

 8. Create a custom post-build script which copies files from
    ${BINARIES_DIR}/boot-part to $(TARGET_DIR)/boot (set its path in
    BR2_ROOTFS_POST_BUILD_SCRIPT):

    #!/bin/sh
    cp -r ${BINARIES_DIR}/boot-part/* ${TARGET_DIR}/boot/

 9. make

10. Run qemu with:

    qemu-system-arm -M vexpress-a9 -kernel output/images/u-boot -m 1024 \
    -nographic -sd output/images/rootfs.ext2

11. In u-boot, stop at the prompt and run grub2 with:

  => ext2load mmc 0:0 ${loadaddr} /boot/grub/grub.img
  => bootm

12. This should bring the grub2 menu, upon which selecting the "Buildroot"
    entry should boot Linux.


Notes on using Grub2 for Aarch64 EFI-based platforms
====================================================

The following steps show how to use the Grub2 arm64-efi platform,
using qemu and EFI firmware built for qemu.

 1. Load aarch64_efi_defconfig

 2. make

 3. Download the EFI firmware for qemu aarch64
    https://www.kraxel.org/repos/jenkins/edk2/
    (or use one provided by your distribution as OVMF-aarch64 or AAVMF)

 4. Run qemu with:

    qemu-system-aarch64 -M virt -cpu cortex-a57 -m 512 -nographic \
    -bios <path/to/EDK2>/QEMU_EFI.fd -hda output/images/disk.img \
    -netdev user,id=eth0 -device virtio-net-device,netdev=eth0

 5. This should bring the grub2 menu, upon which selecting the
    "Buildroot" entry should boot Linux.