Thomas Petazzoni ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
..
0001-Add-missing-grub-core-extra_deps.lst-file-in-release.patch 5baf1ffe7e boot/grub2: bump to version 2.12 1 年間 前
0002-misc-Implement-grub_strlcpy.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0003-fs-ufs-Fix-a-heap-OOB-write.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0004-fs-hfs-Fix-stack-OOB-write-with-grub_strcpy.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0005-fs-tar-Initialize-name-in-grub_cpio_find_file.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0006-fs-tar-Integer-overflow-leads-to-heap-OOB-write.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0007-fs-f2fs-Set-a-grub_errno-if-mount-fails.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0008-fs-hfsplus-Set-a-grub_errno-if-mount-fails.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0009-fs-iso9660-Set-a-grub_errno-if-mount-fails.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0010-fs-iso9660-Fix-invalid-free.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0011-fs-jfs-Fix-OOB-read-in-jfs_getent.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0012-fs-jfs-Fix-OOB-read-caused-by-invalid-dir-slot-index.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0013-fs-jfs-Use-full-40-bits-offset-and-address-for-a-dat.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0014-fs-jfs-Inconsistent-signed-unsigned-types-usage-in-r.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0015-fs-ext2-Fix-out-of-bounds-read-for-inline-extents.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0016-fs-xfs-Fix-out-of-bounds-read.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0017-fs-xfs-Ensuring-failing-to-mount-sets-a-grub_errno.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0018-kern-file-Ensure-file-data-is-set.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0019-kern-file-Implement-filesystem-reference-counting.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0020-disk-loopback-Reference-tracking-for-the-loopback.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0021-kern-disk-Limit-recursion-depth.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0022-kern-partition-Limit-recursion-in-part_iterate.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0023-script-execute-Limit-the-recursion-depth.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0024-net-Unregister-net_default_ip-and-net_default_mac-va.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0025-net-Remove-variables-hooks-when-interface-is-unregis.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0026-net-Fix-OOB-write-in-grub_net_search_config_file.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0027-net-tftp-Fix-stack-buffer-overflow-in-tftp_open.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0028-video-readers-jpeg-Do-not-permit-duplicate-SOF0-mark.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0029-kern-dl-Fix-for-an-integer-overflow-in-grub_dl_ref.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0030-kern-dl-Check-for-the-SHF_INFO_LINK-flag-in-grub_dl_.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0031-commands-extcmd-Missing-check-for-failed-allocation.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0032-commands-ls-Fix-NULL-dereference.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0033-commands-pgp-Unregister-the-check_signatures-hooks-o.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0034-normal-Remove-variables-hooks-on-module-unload.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0035-gettext-Remove-variables-hooks-on-module-unload.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0036-gettext-Integer-overflow-leads-to-heap-OOB-write-or-.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0037-gettext-Integer-overflow-leads-to-heap-OOB-write.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0038-commands-read-Fix-an-integer-overflow-when-supplying.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0039-commands-test-Stack-overflow-due-to-unlimited-recurs.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0040-commands-minicmd-Block-the-dump-command-in-lockdown-.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0041-commands-memrw-Disable-memory-reading-in-lockdown-mo.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0042-commands-hexdump-Disable-memory-reading-in-lockdown-.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0043-fs-bfs-Disable-under-lockdown.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0044-fs-Disable-many-filesystems-under-lockdown.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0045-disk-Use-safe-math-macros-to-prevent-overflows.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0046-disk-Prevent-overflows-when-allocating-memory-for-ar.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0047-disk-Check-if-returned-pointer-for-allocated-memory-.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0048-disk-ieee1275-ofdisk-Call-grub_ieee1275_close-when-g.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0049-fs-Use-safe-math-macros-to-prevent-overflows.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0050-fs-Prevent-overflows-when-allocating-memory-for-arra.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0051-fs-Prevent-overflows-when-assigning-returned-values-.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0052-fs-zfs-Use-safe-math-macros-to-prevent-overflows.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0053-fs-zfs-Prevent-overflows-when-allocating-memory-for-.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0054-fs-zfs-Check-if-returned-pointer-for-allocated-memor.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0055-fs-zfs-Add-missing-NULL-check-after-grub_strdup-call.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0056-net-Use-safe-math-macros-to-prevent-overflows.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0057-net-Prevent-overflows-when-allocating-memory-for-arr.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0058-net-Check-if-returned-pointer-for-allocated-memory-i.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0059-fs-sfs-Check-if-allocated-memory-is-NULL.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0060-script-execute-Fix-potential-underflow-and-NULL-dere.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0061-osdep-unix-getroot-Fix-potential-underflow.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0062-misc-Ensure-consistent-overflow-error-messages.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0063-bus-usb-ehci-Define-GRUB_EHCI_TOGGLE-as-grub_uint32_.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0064-normal-menu-Use-safe-math-to-avoid-an-integer-overfl.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0065-kern-partition-Add-sanity-check-after-grub_strtoul-c.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0066-kern-misc-Add-sanity-check-after-grub_strtoul-call.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0067-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0068-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0069-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0070-fs-xfs-Fix-grub_xfs_iterate_dir-return-value-in-case.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0071-fs-xfs-Propagate-incorrect-inode-error-from-grub_xfs.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0072-fs-xfs-Handle-root-inode-read-failure-in-grub_xfs_mo.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0073-net-drivers-ieee1275-ofnet-Add-missing-grub_malloc.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
0074-Constant-time-grub_crypto_memcmp.patch ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
Config.in c4a4b8552f boot/grub2: Introduce loongarch64-efi target 2 ヶ月 前
grub.cfg 9284b4aa39 boot/grub2: add rootwait to default config 9 年 前
grub2.hash 5baf1ffe7e boot/grub2: bump to version 2.12 1 年間 前
grub2.mk ded3e0045a boot/grub2: add patches to fix numerous CVEs 1 ヶ月 前
readme.txt a480ae9ffe boot/grub2/readme.txt: fix loopback mount notes 4 ヶ月 前

readme.txt

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
loop_dev=$(sudo losetup -f --show disk.img)
sudo partx -a "$loop_dev"
4. Prepare the root partition
sudo mkfs.ext3 -L root "${loop_dev}p1"
sudo mount "${loop_dev}p1" /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 . "$loop_dev"
6. Cleanup loop device
sudo partx -d "$loop_dev"
sudo losetup -d "$loop_dev"
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
loop_dev=$(sudo losetup -f --show disk.img)
sudo partx -a "$loop_dev"
4. Prepare the boot partition
sudo mkfs.vfat -n boot "${loop_dev}p1"
sudo mount "${loop_dev}p1" /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 "${loop_dev}p2"
sudo mount "${loop_dev}p2" /mnt
sudo tar -C /mnt -xf output/images/rootfs.tar
sudo umount /mnt
6 Cleanup loop device
sudo partx -d "$loop_dev"
sudo losetup -d "$loop_dev"
7. Your disk.img is ready!

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

1. Download/install the EFI BIOS for Qemu
You can get it using the edk2 package in Buildroot (installed
in BINARIES_DIR), grab prebuilt images from the unofficial nightly
builds [0], or use one provided by your distribution as OVMF.

[0] https://github.com/retrage/edk2-nightly

2. qemu-system-{i386,x86_64} -bios -hda disk.img

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

You can get it using the edk2 package in Buildroot (installed
in BINARIES_DIR), grab prebuilt images from the unofficial nightly
builds [1], or use one provided by your distribution as OVMF-aarch64
or AAVMF.

[1] https://github.com/retrage/edk2-nightly

4. Run qemu with:

qemu-system-aarch64 -M virt -cpu cortex-a57 -m 512 -nographic \
-bios /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.